<%!--
configmap_env — ConfigMap with env-style keys.
Reads a YAML file from `marea.d/configs/`, treats each top-level key
as an environment variable, and emits them under the ConfigMap's
`data:` block with UPPER_CASED keys and stringified values. Mount it
with `envFrom:` on your Deployment to inject the whole bundle as env
vars in one go.
Wiring (marea.yaml):
releases:
api:
helm:
template: configmap_env.yaml
values:
file: api.env.yaml # basename under marea.d/configs/
Assigns used: @name, @values["file"], @config_files.
--%>
<%
import Marea.Templates, only: [to_dashes: 1, yaml!: 1]
file = Map.fetch!(@values, "file")
data = Map.fetch!(@config_files, file) |> yaml!()
%>
apiVersion: v1
kind: ConfigMap
metadata:
name: <%= to_dashes(@name) %>
data:
<%= for {key, value} <- data do %>
<%= String.upcase(to_string(key)) %>: '<%= value %>'
<% end %>