DB Port inside env
This commit is contained in:
parent
bd355cff1f
commit
00d98874f5
4 changed files with 6 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
DB_TYPE = (mysql|sqlite|...)
|
DB_TYPE = (mysql|sqlite|...)
|
||||||
|
DB_PORT = number
|
||||||
DB_HOST = database_host
|
DB_HOST = database_host
|
||||||
DB_NAME = database_name
|
DB_NAME = database_name
|
||||||
DB_USERNAME = database_username
|
DB_USERNAME = database_username
|
||||||
|
|
|
@ -23,8 +23,9 @@ services:
|
||||||
container_name: ff_member_administration_server
|
container_name: ff_member_administration_server
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- DB_TYPE = mysql
|
- DB_TYPE=mysql
|
||||||
- DB_HOST=ffm-db
|
- DB_HOST=ffm-db
|
||||||
|
- DB_PORT=number # fallback ist auf 3306 gesetzt
|
||||||
- DB_NAME=administration
|
- DB_NAME=administration
|
||||||
- DB_USERNAME=administration_backend
|
- DB_USERNAME=administration_backend
|
||||||
- DB_PASSWORD=<dbuserpasswd>
|
- DB_PASSWORD=<dbuserpasswd>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import "dotenv/config";
|
import "dotenv/config";
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { DataSource } from "typeorm";
|
import { DataSource } from "typeorm";
|
||||||
import { DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_TYPE } from "./env.defaults";
|
import { DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_TYPE, DB_PORT } from "./env.defaults";
|
||||||
|
|
||||||
import { user } from "./entity/user/user";
|
import { user } from "./entity/user/user";
|
||||||
import { refresh } from "./entity/refresh";
|
import { refresh } from "./entity/refresh";
|
||||||
|
@ -70,7 +70,7 @@ import { ExtendViewValues1736084198860 } from "./migrations/1736084198860-extend
|
||||||
const dataSource = new DataSource({
|
const dataSource = new DataSource({
|
||||||
type: DB_TYPE as any,
|
type: DB_TYPE as any,
|
||||||
host: process.env.NODE_ENV || process.env.DBMODE ? "localhost" : DB_HOST,
|
host: process.env.NODE_ENV || process.env.DBMODE ? "localhost" : DB_HOST,
|
||||||
port: 3306,
|
port: DB_PORT,
|
||||||
username: DB_USERNAME,
|
username: DB_USERNAME,
|
||||||
password: DB_PASSWORD,
|
password: DB_PASSWORD,
|
||||||
database: DB_NAME,
|
database: DB_NAME,
|
||||||
|
|
|
@ -3,6 +3,7 @@ import ms from "ms";
|
||||||
|
|
||||||
export const DB_TYPE = process.env.DB_TYPE ?? "mysql";
|
export const DB_TYPE = process.env.DB_TYPE ?? "mysql";
|
||||||
export const DB_HOST = process.env.DB_HOST ?? "";
|
export const DB_HOST = process.env.DB_HOST ?? "";
|
||||||
|
export const DB_PORT = Number(process.env.DB_PORT ?? 3306);
|
||||||
export const DB_NAME = process.env.DB_NAME ?? "";
|
export const DB_NAME = process.env.DB_NAME ?? "";
|
||||||
export const DB_USERNAME = process.env.DB_USERNAME ?? "";
|
export const DB_USERNAME = process.env.DB_USERNAME ?? "";
|
||||||
export const DB_PASSWORD = process.env.DB_PASSWORD ?? "";
|
export const DB_PASSWORD = process.env.DB_PASSWORD ?? "";
|
||||||
|
|
Loading…
Reference in a new issue