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

fix init_db.sql to also take variables from environment #556

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

Mortom123
Copy link
Contributor

Motivation

The init script inside the docker container did not depend on the environment variables that were set in the backend (USERNAME / PASSWORD). This can lead to problems when trying to connect to the database and expecting the same credentials as set in the environment.

No errors where visible because postgre "trusts" connections from localhost by default, hence the backend did not have to authenticate / was allowed to authenticate incorrectly.

Modifications

The first SQL command to alter the role is made dependent on the environment variables.

Verifying this change

  • Make sure that the change passes the ./gradlew build checks. (they are not part of these checks I assume)

docker/init_db.sql Outdated Show resolved Hide resolved
Co-authored-by: Lari Hotari <[email protected]>
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@lhotari lhotari merged commit 3e5430c into apache:master Apr 3, 2024
1 check passed
@liangyepianzhou liangyepianzhou added this to the 0.4.0 milestone Jan 10, 2025
liangyepianzhou pushed a commit that referenced this pull request Jan 12, 2025
* fix init_db.sql to also take variables from environment

* make other occurrences of username dynamic

* Update docker/init_db.sql

Co-authored-by: Lari Hotari <[email protected]>
(cherry picked from commit 3e5430c)
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.

3 participants