Build step
The build step is responsible for creating your configurations files. There are two implementation of the build step in the BigConfig DSL: render and build.
render
Section titled “render”Most of the time you will use the step render. The opts key is :big-config.render/templates or its shorter version ::render/templates. It contains a list of templates and how to transform them.
{::run/shell-opts {:dir dir} ::render/templates [{:template "stage-1" :target-dir (format "resources/stage-2/%s" profile) :overwrite :delete :transform [["common" :raw] ["{{ profile }}" :raw]]} {:template "stage-2" :target-dir dir :overwrite :delete :transform [["{{ profile }}"]]}]}It’s a modified version of deps-new template DSL.
template.ednhas been replaced by::render/templates.- Intead of one template, you can have multiple templates.
- The template language is Selmer .
:templateis the resource path containingrootdirectory.:roothas been removed to improve validation.
predefined keys
Section titled “predefined keys”Any key besides these will be part of data along with the keys :module and :profile.
:template:target-dir:overwrite:data-fn:template-fn:post-process-fn:transform
{:aws-profile "default" :region "eu-west-1" :dev "111111111111" :prod "222222222222" :post-process-fn [rename upgrade] :transform [["root" {"projectile" ".projectile"} {:tag-open \< :tag-close \> :filter-open \< :filter-close \>}]]}data-fn key
Section titled “data-fn key”This function is called to produce data form opts and the non predefined keys in template. Usually no other key besides module and profile are needed from opts and they are already populated automatically.
template-fn key
Section titled “template-fn key”This function is called with data and edn to enable the modification of all parameters before running the template.
transform key
Section titled “transform key”srcis interpolated liketarget
{:transform [["{{ profile }}"]]}srccan by a symbol or a function. In this casefromoffilesshould be a keyword and it will be pass to the function to obtain the content ofto.
{:transform [['ansible/kw->content "roles/users/tasks" {:packages "packages.yml" :repos "repos.yml" :ssh-config "ssh-config.yml"} :raw]]}- after
filesthere is another map to overide the Selmer delimiters.
{:transform [["root" {"projectile" ".projectile"} {:tag-open \< :tag-close \> :filter-open \< :filter-close \>}]]}If the default template engine doesn’t work for you, build enables you to provide a Clojure function to build your configuration files. Before render BigConfig had only build with a function to use
deps-new to render the configuration files.