Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const dir = process.cwd();
const envConfigDir = path.join(dir, 'config', 'environments', 'development');
const serverConfig = await loadConfigFile(envConfigDir, 'server.+(js|json)');
const port = _.get(serverConfig, 'port', 1337);
const host = _.get(serverConfig, 'host', 'localhost');
const adminPort = _.get(serverConfig, 'admin.port', 8000);
const adminHost = _.get(serverConfig, 'admin.host', 'localhost');
const adminBackend = _.get(
serverConfig,
'admin.build.backend',
`http://${host}:${port}`
);
const adminPath = _.get(serverConfig, 'admin.path', '/admin');
strapiAdmin.watchAdmin({
dir,
port: adminPort,
host: adminHost,
options: {
backend: adminBackend,
publicPath: addSlash(adminPath),
},
});
};