Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions devU-api/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,32 @@ const refreshTokenExp = load('auth.jwt.refreshTokenValiditySeconds') || 864000
const accessTokenExp = load('auth.jwt.accessTokenValiditySeconds') || 600
const refreshTokenBuffer = load('auth.jwt.refreshTokenExpirationBufferSeconds') || 864000

// if the dev env exists then file is running inside docker
// if it is undefined it is running on dev machine
const isDocker = !(process.env.dev === undefined)


const environment = {
port,
apiUrl,
clientUrl: (process.env.CLIENT_URL || load('api.clientUrl') || 'http://localhost:9000') as string,

// Database settings
dbHost: (load('database.host') || 'localhost') as string,
dbHost: isDocker ? load('database.host') : 'localhost' as string,
dbUsername: (load('database.username') || 'typescript_user') as string,
dbPassword: (load('database.password') || 'password') as string,
database: (load('database.name') || 'typescript_api') as string,

// the below one is for local migration, due to some issues with command will not running load function nor 'localhost'

// dbHost: ('localhost') as string,
// dbUsername: ('typescript_user') as string,
// dbPassword: ('password') as string,
// database: ('typescript_api') as string,


// MinIO setting
minioHost: (load('minio.host') || 'localhost') as string,
minioHost: isDocker ? load('minio.host') : 'localhost' as string,
minioPort: (load('minio.port') || 9002) as number,
minioUsername: (load('minio.username') || 'typescript_user') as string,
minioPassword: (load('minio.password') || 'changeMe') as string,
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
dockerfile: api.Dockerfile
environment:
WAIT_HOSTS: db:5432
dev: 0 # value here is irrelevant; just here to make sure dev env exists
depends_on:
db:
condition: service_started
Expand Down