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

Allow database.url in the config for example for symfony based applications #146

Open
amenk opened this issue Dec 12, 2024 · 2 comments
Open

Comments

@amenk
Copy link
Contributor

amenk commented Dec 12, 2024

Is your feature request related to a problem? Please describe.

When dumping a database of a symfony project such as Shopware, the database credentials are usually stored in the environment / .env / .env.local in such a format:

DATABASE_URL=mysql://foo:password@localhost:3306/databasename

The configuration file expects the database settings separated.

Describe the solution you'd like

Add optional setting url to the database node which can be used instead of the other fields to specific the database connection URL.

So we could write in the config:

database:
    url: '%env(DATABASE_URL)%'

and then just call

source .env.local
gdpr-dump

which would simplify our scripts.

Describe alternatives you've considered

We currently parse the URL ourselves and pass it on into the environment.

More

What do you think about the future? Is it in scope? Shall we try to provide a PR?

@back-2-95
Copy link

Can also help if doing the dump creation e.g. in Github Actions and you'd like to give the DATABASE_URL in one secret instead of e.g. 5

@amenk
Copy link
Contributor Author

amenk commented Dec 13, 2024

I can try to make a PR, entry point:

$database = $config->get('database', []);

idea: add a function which parses the URL and pre-populates the fields. Parts of the URL could still be overwritten by the single parameters than, allowing both

probably it can be a config compiler...

amenk added a commit to iMi-digital/gdpr-dump that referenced this issue Dec 13, 2024
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

No branches or pull requests

2 participants