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

Add the ability to use fallback value for environment variables #134

Closed
DnD-Sony opened this issue May 17, 2024 · 3 comments · Fixed by #135
Closed

Add the ability to use fallback value for environment variables #134

DnD-Sony opened this issue May 17, 2024 · 3 comments · Fixed by #135

Comments

@DnD-Sony
Copy link

Use case
Sometime the environment variables in .env files could be different between local, staging/production on multiple project in our Web Agency.

Describe the solution you'd like
We would like to use the same mechanic provided by Symfony
https://symfony.com/doc/current/configuration/env_var_processors.html#built-in-environment-variable-processors
(search the part related for env(default:fallback_param:BAR))

Describe alternatives you've considered
We added some modifications to this class \Smile\GdprDump\Config\Compiler\Processor\EnvVarProcessor and we would like to submit a Pull Request

The setting now can looks like this

database:
  host: '%env(default:DB_HOST:MYSQL_HOST)%'
  user: '%env(default:DB_USER:MYSQL_USER)%'
  password: '%env(default:DB_PASSWORD:MYSQL_PASSWORD)%'
  name: '%env(default:DB_NAME:MYSQL_DB)%'
@DnD-Sony
Copy link
Author

Hi @guvra , do you think we can have an update on this ?

@guvra
Copy link
Collaborator

guvra commented Jun 4, 2024

Hi, I plan to add the following options to the command-line: --database, --host, --port, --user, --password

It would allow to override values for a specific environment, for example:

  • gdpr-dump.phar config.yaml --host=myhost
  • gdpr-dump.phar config.yaml --host=$MYSQL_HOST

It would probably solve your use case as well, can you confirm this?

@DnD-Sony
Copy link
Author

DnD-Sony commented Jun 4, 2024

Hi, yes I think it would be really useful to have these options !
Thanks!

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 a pull request may close this issue.

2 participants