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 providing a default value in config when env variable does not exist #1600

Closed
ricardogsilva opened this issue Mar 19, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ricardogsilva
Copy link
Member

It would be useful if the pygeoapi config file would allow defining a default value for when an environment variable is not defined.

Something like:

        ...
        providers:
            - type: feature
              name: Elasticsearch
              data: ${ELASTICSEARCH_SERVER_URL:-http://localhost:9200}/canada-hydat-daily-mean-02hc003
              id_field: IDENTIFIER
              time_field: DATE

In the snippet above, pygeoapi would try to load the ELASTICSEARCH_SERVER_URL variable from the environment and in case this variable would not exist, then a default value of http://localhost:9200 would be used.

Additional context
This feature would be useful for me to be able to run, for example the CITE tests in a docker compose stack without having to modify the existing CITE related config file that is present in the tests

I would be willing to provide an implementation for this in a PR if this is deemed a suitable addition

@ricardogsilva ricardogsilva added the enhancement New feature or request label Mar 19, 2024
@tomkralidis
Copy link
Member

Makes sense @ricardogsilva, and +1 for a PR (looks like an update to pygeoapi.util.yaml_load would do the trick).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants