Refacto environment service (#4473)
* Refacto environment service * Remove environment variable type
This commit is contained in:
@ -19,14 +19,14 @@ export class DataSeedDemoWorkspaceService {
|
||||
async seedDemo(): Promise<void> {
|
||||
try {
|
||||
const dataSource = new DataSource({
|
||||
url: this.environmentService.getPGDatabaseUrl(),
|
||||
url: this.environmentService.get('PG_DATABASE_URL'),
|
||||
type: 'postgres',
|
||||
logging: true,
|
||||
schema: 'public',
|
||||
});
|
||||
|
||||
await dataSource.initialize();
|
||||
const demoWorkspaceIds = this.environmentService.getDemoWorkspaceIds();
|
||||
const demoWorkspaceIds = this.environmentService.get('DEMO_WORKSPACE_IDS');
|
||||
|
||||
if (demoWorkspaceIds.length === 0) {
|
||||
throw new Error(
|
||||
|
||||
@ -38,7 +38,7 @@ export class DataSeedWorkspaceCommand extends CommandRunner {
|
||||
async run(): Promise<void> {
|
||||
try {
|
||||
const dataSource = new DataSource({
|
||||
url: this.environmentService.getPGDatabaseUrl(),
|
||||
url: this.environmentService.get('PG_DATABASE_URL'),
|
||||
type: 'postgres',
|
||||
logging: true,
|
||||
schema: 'core',
|
||||
|
||||
@ -20,7 +20,7 @@ export class TypeORMService implements OnModuleInit, OnModuleDestroy {
|
||||
|
||||
constructor(private readonly environmentService: EnvironmentService) {
|
||||
this.mainDataSource = new DataSource({
|
||||
url: environmentService.getPGDatabaseUrl(),
|
||||
url: environmentService.get('PG_DATABASE_URL'),
|
||||
type: 'postgres',
|
||||
logging: false,
|
||||
schema: 'core',
|
||||
@ -83,9 +83,9 @@ export class TypeORMService implements OnModuleInit, OnModuleDestroy {
|
||||
const schema = dataSource.schema;
|
||||
|
||||
const workspaceDataSource = new DataSource({
|
||||
url: dataSource.url ?? this.environmentService.getPGDatabaseUrl(),
|
||||
url: dataSource.url ?? this.environmentService.get('PG_DATABASE_URL'),
|
||||
type: 'postgres',
|
||||
logging: this.environmentService.isDebugMode()
|
||||
logging: this.environmentService.get('DEBUG_MODE')
|
||||
? ['query', 'error']
|
||||
: ['error'],
|
||||
schema,
|
||||
|
||||
Reference in New Issue
Block a user