Closed bmf-san closed 5 months ago
I want to be able to use environment variables in configuration files.
Implement parsing when environment variables are included.
proxy: port: {{ .env.Port }} read_header_timeout: 2000 shutdown_timeout: 3000 tls_cert_path: certificates/cert.pem tls_key_path: certificates/key.pem static_files: - path: /public/ dir: ./public upstreams: - host_name: backend1.local target: http://backend1:8081 # backend1 is the name of the container - host_name: backend2.local target: http://backend2:8082 # backend2 is the name of the container log_level: 0 # Debug:-4 Info:0 Warn:4 Error:8
↓
proxy: port: 443 read_header_timeout: 2000 shutdown_timeout: 3000 tls_cert_path: certificates/cert.pem tls_key_path: certificates/key.pem static_files: - path: /public/ dir: ./public upstreams: - host_name: backend1.local target: http://backend1:8081 # backend1 is the name of the container - host_name: backend2.local target: http://backend2:8082 # backend2 is the name of the container log_level: 0 # Debug:-4 Info:0 Warn:4 Error:8
Consider ways such as parsing environment variables in YAML files, or preparing TPL and converting TPL to YAML.
This can be easily implemented using os.ExpandEnv.
os.ExpandEnv
cf. https://pkg.go.dev/os#example-ExpandEnv
Description
I want to be able to use environment variables in configuration files.
Implement parsing when environment variables are included.
Describe the feature you'd like to request
↓
Describe the solution you'd like
Consider ways such as parsing environment variables in YAML files, or preparing TPL and converting TPL to YAML.