Strapi is a very famous and powerful CMS system. It has a business enterprise version to limit free user that can only create three type of user role. So how could it do this. Let’s learn it.

First, we should run a strapi instance in your local machine. Open the admin url, press the F12, in the developer tools, we can find a request named information like this.

the response should like this

{"data":
{"currentEnvironment":"development",
"autoReload":true,
"strapiVersion":"4.1.10",
"nodeVersion":"v16.14.2","communityEdition":false,"useYarn":false}}

the column communityEdition should be the enterprise credentials.

In the normal case , we cannot search the url “/admin/information” in the node_modules. haha , but when we search information(), you could get this.

the code is

const currentEnvironment = strapi.config.get('environment');
const autoReload = strapi.config.get('autoReload', false);
const strapiVersion = strapi.config.get('info.strapi', null);
const nodeVersion = process.version;
const communityEdition = !strapi.EE;
const useYarn = await exists(path.join(process.cwd(), 'yarn.lock'));
 the credential should be injected when the process start. 

then above the code I found this.

const ee = require('@strapi/strapi/lib/utils/ee');

Ok, it’s the final file. the path is node_modules/@strapi/strapi/lib/utils/ee.js

const licensePath = path.join(dir, 'license.txt');

  let license;
  if (_.has(process.env, 'STRAPI_LICENSE')) {
    license = process.env.STRAPI_LICENSE;
  } else if (fs.existsSync(licensePath)) {
    license = fs.readFileSync(licensePath).toString();
  }
  if (_.isNil(license)) {
    internals.isEE = false;
    return false;
  }

the core logic seems like if you buy the enterprise credential, you would get a license that you could put it in the STRAPI_LICENSE directory.

The last , ps. if you want to test the EE in your local , just do this .

and

and the sso feature is here node_modules/@strapi/admin/server/controllers/admin.js

haha . When I saw FIXME, I felt a little funny.

The End. Welcome to contact me.