1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/server-dev.ts

85 lines
3.3 KiB
TypeScript
Raw Normal View History

2021-08-13 19:22:15 +02:00
import { start } from './lib/server-impl';
import { createConfig } from './lib/create-config';
2021-04-23 15:31:12 +02:00
import { LogLevel } from './lib/logger';
import { ApiTokenType } from './lib/types/models/api-token';
process.nextTick(async () => {
try {
2021-08-13 19:22:15 +02:00
await start(
createConfig({
db: process.env.DATABASE_URL
? undefined
: {
user: 'unleash_user',
password: 'password',
host: 'localhost',
port: 5432,
database:
process.env.UNLEASH_DATABASE_NAME || 'unleash',
schema: process.env.UNLEASH_DATABASE_SCHEMA,
ssl: false,
applicationName: 'unleash',
},
server: {
enableRequestLogger: true,
baseUriPath: '',
// keepAliveTimeout: 1,
gracefulShutdownEnable: true,
// cdnPrefix: 'https://cdn.getunleash.io/unleash/v4.4.1',
enableHeapSnapshotEnpoint: true,
},
logLevel: LogLevel.debug,
secureHeaders: false,
versionCheck: {
enable: false,
},
experimental: {
// externalResolver: unleash,
flags: {
embedProxy: true,
embedProxyFrontend: true,
anonymiseEventLog: false,
responseTimeWithAppNameKillSwitch: false,
stripClientHeadersOn304: true,
newStrategyConfiguration: true,
stripHeadersOnAPI: true,
celebrateUnleash: true,
increaseUnleashWidth: true,
newStrategyConfigurationFeedback: true,
featureSearchFeedbackPosting: true,
extendedUsageMetricsUI: true,
2024-01-18 12:32:25 +01:00
executiveDashboard: true,
sdkReporting: true,
},
},
authentication: {
initApiTokens: [
{
environment: '*',
project: '*',
2022-01-05 10:40:22 +01:00
secret: '*:*.964a287e1b728cb5f4f3e0120df92cb5',
type: ApiTokenType.ADMIN,
tokenName: 'some-user',
},
],
},
/* can be tweaked to control configuration caching for /api/client/features
clientFeatureCaching: {
enabled: true,
maxAge: 4000,
},
*/
}),
);
} catch (error) {
if (error.code === 'EADDRINUSE') {
// eslint-disable-next-line no-console
console.warn('Port in use. You might want to reload once more.');
} else {
// eslint-disable-next-line no-console
console.error(error);
process.exit();
}
}
}, 0);