mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-13 00:02:30 +10:00
Fix env path for Nestjs
This commit is contained in:
@ -1,8 +1,7 @@
|
|||||||
import { DataSource } from 'typeorm';
|
import { DataSource } from 'typeorm';
|
||||||
import * as dotenv from 'dotenv';
|
import * as dotenv from 'dotenv';
|
||||||
import { NamingStrategy } from './naming-strategy';
|
import { NamingStrategy } from './naming-strategy';
|
||||||
import * as path from 'path';
|
import { envPath } from '../helpers/utils';
|
||||||
const envPath = path.resolve(process.cwd(), '..', '..', '.env');
|
|
||||||
|
|
||||||
dotenv.config({ path: envPath });
|
dotenv.config({ path: envPath });
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
export function generateHostname(name: string): string {
|
export function generateHostname(name: string): string {
|
||||||
let hostname = name.replace(/[^a-z0-9]/gi, '').toLowerCase();
|
let hostname = name.replace(/[^a-z0-9]/gi, '').toLowerCase();
|
||||||
hostname = hostname.substring(0, 30);
|
hostname = hostname.substring(0, 30);
|
||||||
return hostname;
|
return hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const envPath = path.resolve(process.cwd(), '..', '..', '.env');
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { Global, Module } from '@nestjs/common';
|
|||||||
import { EnvironmentService } from './environment.service';
|
import { EnvironmentService } from './environment.service';
|
||||||
import { ConfigModule } from '@nestjs/config';
|
import { ConfigModule } from '@nestjs/config';
|
||||||
import { validate } from './environment.validation';
|
import { validate } from './environment.validation';
|
||||||
|
import { envPath } from '../../helpers/utils';
|
||||||
|
|
||||||
@Global()
|
@Global()
|
||||||
@Module({
|
@Module({
|
||||||
@ -9,6 +10,7 @@ import { validate } from './environment.validation';
|
|||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
expandVariables: true,
|
expandVariables: true,
|
||||||
|
envFilePath: envPath,
|
||||||
validate,
|
validate,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user