Skip to content

Commit

Permalink
Replace the database user and its password in application configuration.
Browse files Browse the repository at this point in the history
The change is done in order to spot possible database permission issues.
Also, remove defaulting to Hasura user in Docker setup.

Continue to use the Hasura user for integration tests, as Data-Inserter needs
permissions to execute TRUNCATE commands on the database.

Resolves HSLdevcom/jore4#1551
  • Loading branch information
jarkkoka committed Oct 18, 2023
1 parent 1683c94 commit afe58eb
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
7 changes: 7 additions & 0 deletions docker/docker-compose.custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ services:
- jore4
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- './secret-timetablesapi-jore4-db-database:/mnt/secrets-store/jore4-db-database'
- './secret-timetablesapi-jore4-db-username:/mnt/secrets-store/jore4-db-username'
- './secret-timetablesapi-jore4-db-password:/mnt/secrets-store/jore4-db-password'
environment:
SECRET_STORE_BASE_PATH: "/mnt/secrets-store"
JORE4_DB_HOSTNAME: "jore4-testdb"

jore4-hasura:
# locking hasura image so that we can develop against a static graphql API
Expand Down
14 changes: 11 additions & 3 deletions profiles/dev/config.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Datasource settings of the Jore 4 development database
# Database settings for the Jore 4 development database
jore4.db.driver=org.postgresql.Driver
jore4.db.url=jdbc:postgresql://localhost:6432/timetablesdb?stringtype=unspecified
jore4.db.username=dbhasura
jore4.db.password=hasurapassword
jore4.db.username=dbtimetablesapi
jore4.db.password=timetablesapipassword
jore4.db.min.connections=0
jore4.db.max.connections=5

# Database settings for the integration test database
jore4.test.db.driver=org.postgresql.Driver
jore4.test.db.url=jdbc:postgresql://localhost:6432/timetablesdb?stringtype=unspecified
jore4.test.db.username=dbhasura
jore4.test.db.password=hasurapassword
jore4.test.db.min.connections=0
jore4.test.db.max.connections=5

# jOOQ code generation configuration
jooq.generator.db.dialect=org.jooq.meta.postgres.PostgresDatabase
jooq.sql.dialect=POSTGRES
6 changes: 0 additions & 6 deletions script/build-jdbc-urls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ set -eu

# if JORE4_DB_URL was not set, build it from parts
if [ -z "${JORE4_DB_URL+x}" ]; then
export JORE4_DB_HOSTNAME=${JORE4_DB_HOSTNAME:-"jore4-testdb"}
export JORE4_DB_PORT=${JORE4_DB_PORT:-"5432"}
export JORE4_DB_DATABASE=${JORE4_DB_DATABASE:-"timetablesdb"}
export JORE4_DB_URL="jdbc:postgresql://${JORE4_DB_HOSTNAME}:${JORE4_DB_PORT}/${JORE4_DB_DATABASE}?stringtype=unspecified"
fi

# Set dev auth if it is not defined
export JORE4_DB_USERNAME=${JORE4_DB_USERNAME:-"dbhasura"}
export JORE4_DB_PASSWORD=${JORE4_DB_PASSWORD:-"hasurapassword"}
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ [email protected]@
jore4.db.password[email protected]@
jore4.db.minConnections[email protected]@
jore4.db.maxConnections[email protected]@

jooq.sql.dialect[email protected]@
8 changes: 8 additions & 0 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
jore4.db.driver[email protected]@
jore4.db.url[email protected]@
jore4.db.username[email protected]@
jore4.db.password[email protected]@
jore4.db.minConnections[email protected]@
jore4.db.maxConnections[email protected]@

jooq.sql.dialect[email protected]@

0 comments on commit afe58eb

Please sign in to comment.