Created
June 21, 2019 04:58
-
-
Save ixahmedxi/9eadb24c868dd40cdfe7f00b243914e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as dotenv from 'dotenv' | |
import * as fs from 'fs' | |
export class ConfigService { | |
private readonly envConfig: { [key: string]: string } | |
constructor(mode: 'development' | 'production') { | |
this.envConfig = dotenv.parse(fs.readFileSync(`${mode}.env`)) | |
} | |
get(key: string): string { | |
return this.envConfig[key] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment