On Sunday, May 17, 2020 at 7:19:23 PM UTC+2, Shishira Pradhan wrote: > > In springboot, we have configuration like port, database etc info are > stored in yaml files like application-dev.yml, application-test.yml, > application-prod.yml profiles, and profile name is passed during running > the application to load profile specific configuration. I need to > understand that how to load/pass profile based properties in golang ? > I use Docker a lot at work (everything we do runs on AWS or Google servers), and that makes separating things relatively simple.
AWS has different environment variables for different configurations, allowing one Docker image to run with different settings. With docker-compose you can tie together tailored Dockerfiles and different images for different purposes, as needed. I recommend having a default "docker-compose.yml" be the dev environment, with its own environment variables, and variants for staging/prod with other names expecting envvars from the system it's running on. This makes the default invocations of docker-compose launch in local dev mode. We use a lot of Python (Django, Wagtail) which expects envvars anyway, so it's a natural way to do things there. For Go I either write AWS-specific things which only expect envvars, or use a configuration system which overrides config files with outside vars. We haven't started using Kubernetes yet, but the process probably won't be much different. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7c421559-8a25-450b-9e4f-b48e72f8f985%40googlegroups.com.