Skip to content

Combining secrets and environment variables #45537

Answered by jdevinemt
jdevinemt asked this question in Q&A
Discussion options

You must be logged in to vote

I decided to just use parameters for the non-sensitive values. Here is the setup I went with:

# config/services.yaml
properties:
    app.db.mysql.dsn: mysql:host=%env(MYSQL_DB_HOST)%;
    app.db.mysql.url: mysql://%env(MYSQL_DB_USER)%:%env(MYSQL_DB_PASSWORD)%@%env(MYSQL_DB_HOST)%

# config/packages/doctrine.yaml
doctrine:
    dbal:
        url: %app.db.mysql.url%/main

# secrets
MYSQL_DB_HOST=hostname
MYSQL_DB_USER=username
MYSQL_DB_PASSWORD=password

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Adambean
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by jdevinemt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants