Read db password from env

This commit is contained in:
Cory Sanin 2025-01-14 20:22:59 -05:00
parent 4a3ce70751
commit c83b7535c1
3 changed files with 4 additions and 2 deletions

View File

@ -9,6 +9,8 @@ services:
volumes:
- ./config:/srv/abt/config
- /var/run/docker.sock:/var/run/docker.sock
environment:
- PASSWORD: ${POSTGRES_PASSWORD}
restart: "no"
ports:
- 8080:8080

View File

@ -48,7 +48,7 @@ class DB {
private sequelize: Sequelize;
constructor(config: DBConfig = {}) {
this.sequelize = new Sequelize(config.db || 'archery', config.user || 'archery', config.password || '', {
this.sequelize = new Sequelize(config.db || 'archery', config.user || 'archery', process.env.PASSWORD || config.password || '', {
host: config.host || 'localhost',
port: config.port || 5432,
dialect: 'postgres'

View File

@ -11,7 +11,7 @@ interface compositeConfig {
db?: DBConfig
}
const config: compositeConfig = JSON.parse(await fs.promises.readFile(process.env.config || path.join('config', 'config.json'), 'utf-8'));
const config: compositeConfig = JSON.parse(await fs.promises.readFile(process.env.config || process.env.CONFIG || path.join('config', 'config.json'), 'utf-8'));
const web = new Web(config.web);
const buildController = new BuildController();