Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Env vars to override DB connection #748

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

devhawk
Copy link
Collaborator

@devhawk devhawk commented Feb 6, 2025

No description provided.

configFile['database']['local_suffix'] =
configFile['database']['local_suffix'] || databaseConnection['local_suffix'] || false;
configFile.database.hostname =
process.env.DBOS_DBHOST ?? configFile.database.hostname ?? databaseConnection.hostname ?? 'localhost';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we change to ?? (nullish coalescing) instead of || (the OR operator)? I think the benefit of || is that if the env variable is set to an empty string, it will consider to be not set. Otherwise, we might get some empty string variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will change it back

process.env.PGPASSWORD ??
'dbos';
const dbos_dblocalsuffix = process.env.DBOS_DBLOCALSUFFIX ? process.env.DBOS_DBLOCALSUFFIX === 'true' : undefined;
configFile.database.local_suffix =
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, using || for boolean | undefined values is probably not what we want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants