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
Gastón Fournier ab4a6f5c92
chore: GA project specific segments (#3583)
## About the changes
General availability of project-specific segments 

Now new permissions can be assigned to non-admin users to allow them to
create segments specifically bounded to a project (note that unique
naming restriction applies across projects, this limitation can be
lifted later).

![image](https://user-images.githubusercontent.com/455064/233579161-40ab25c5-a306-4fbc-82e5-8d09b3cb6a5f.png)

This enables a section in the project configuration to add
project-specific segments

![image](https://user-images.githubusercontent.com/455064/233578924-7056c626-ff1f-4dad-b00c-7fbd851158a6.png)
2023-04-21 10:25:40 +02:00

78 lines
2.8 KiB
TypeScript

import { start } from './lib/server-impl';
import { createConfig } from './lib/create-config';
import { LogLevel } from './lib/logger';
import { ApiTokenType } from './lib/types/models/api-token';
process.nextTick(async () => {
try {
await start(
createConfig({
db: {
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,
enableOAS: true,
// secureHeaders: true,
versionCheck: {
enable: false,
},
experimental: {
// externalResolver: unleash,
flags: {
embedProxy: true,
embedProxyFrontend: true,
anonymiseEventLog: false,
responseTimeWithAppNameKillSwitch: false,
newProjectOverview: true,
bulkOperations: true,
projectScopedStickiness: true,
optimal304: true,
optimal304Differ: false,
},
},
authentication: {
initApiTokens: [
{
environment: '*',
project: '*',
secret: '*:*.964a287e1b728cb5f4f3e0120df92cb5',
type: ApiTokenType.ADMIN,
username: '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);