ajnisbet / opentopodata

Open alternative to the Google Elevation API!
https://www.opentopodata.org
MIT License
312 stars 69 forks source link

Make CONFIG_PATH configurable via environment variable #60

Closed ntdt closed 2 years ago

ntdt commented 2 years ago

Hi, I'm deploying opentopodata to k8s and I have to do workaround to make the config.yaml file available to the pod.

My suggestion is to change the code so CONFIG_PATH could be read from environment variable so I can export it as CONFIG_PATH=/config/config.yaml

Thanks.

ajnisbet commented 2 years ago

Yeah it'd be easy to add this. I'm curious though, is it not possible in k8s to mount a single file, like it is in docker?

ntdt commented 2 years ago

Yeah it'd be easy to add this. I'm curious though, is it not possible in k8s to mount a single file, like it is in docker?

No, it's not the case. Following this documentation https://kubernetes.io/docs/concepts/configuration/configmap/#using-configmaps-as-files-from-a-pod

Modify your image or command line so that the program looks for files in that directory. Each key in the ConfigMap data map becomes the filename under mountPath.

I've tested it and if I set the mountPath: /app/config.yaml then inside the pod, I can see a folder app/config.yaml/ that contains the file config.yaml

ajnisbet commented 2 years ago

Ah ok, it looks like ConfigMap is more complicated than just mounting a file.

ajnisbet commented 2 years ago

This is now in master! There's a note in the docs: https://www.opentopodata.org/server/#configuration