|
1 | | -import { logger, SharedSystemProp, system } from '@openops/server-shared'; |
2 | | -import { EnvironmentType, Provider } from '@openops/shared'; |
| 1 | +import { AppSystemProp, logger, system } from '@openops/server-shared'; |
| 2 | +import { Provider } from '@openops/shared'; |
3 | 3 | import { getAuthenticationService } from '../../authentication/authentication-service-factory'; |
4 | 4 | import { FlagEntity } from '../../flags/flag.entity'; |
5 | 5 | import { databaseConnection } from '../database-connection'; |
6 | 6 |
|
7 | 7 | const DEV_DATA_SEEDED_FLAG = 'DEV_DATA_SEEDED'; |
8 | 8 |
|
9 | | -const currentEnvIsNotDev = (): boolean => { |
10 | | - const env = system.get(SharedSystemProp.ENVIRONMENT); |
11 | | - return env !== EnvironmentType.DEVELOPMENT; |
| 9 | +const devSeedingEnabled = (): boolean => { |
| 10 | + return system.getBoolean(AppSystemProp.SEED_DEV_DATA) ?? false; |
12 | 11 | }; |
13 | 12 |
|
14 | 13 | const devDataAlreadySeeded = async (): Promise<boolean> => { |
@@ -49,11 +48,8 @@ const seedDevUser = async (): Promise<void> => { |
49 | 48 | }; |
50 | 49 |
|
51 | 50 | export const seedDevData = async (): Promise<void> => { |
52 | | - if (currentEnvIsNotDev()) { |
53 | | - logger.info( |
54 | | - { name: 'seedDevData' }, |
55 | | - 'skip: not in development environment', |
56 | | - ); |
| 51 | + if (!devSeedingEnabled()) { |
| 52 | + logger.info({ name: 'seedDevData' }, 'skip: dev data seeding disabled'); |
57 | 53 | return; |
58 | 54 | } |
59 | 55 |
|
|
0 commit comments