34 lines
1 KiB
Text
34 lines
1 KiB
Text
local appr = import "appr.libsonnet";
|
|
local b64e = appr.b64decode;
|
|
|
|
function(vars={})
|
|
|
|
# Deserialize config.yaml if exists
|
|
local local_stack_config = (
|
|
local confpath = "config.yaml";
|
|
if std.objectHasAll(vars.stack_files, confpath)
|
|
then appr.loadObject(appr.b64decode(vars.stack_files[confpath]))
|
|
else {}
|
|
);
|
|
|
|
# Merge all config together
|
|
# Precedence: local stack/config.yaml < package-config (vars.config) < base-config (vars.base-config)
|
|
local config_yaml = {'config.yaml': appr.b64encode(appr.to_yaml(
|
|
local_stack_config +
|
|
vars.config +
|
|
vars.base_config))};
|
|
|
|
# Merge stack files
|
|
local stack_files = vars.stack_files + config_yaml;
|
|
|
|
{
|
|
apiVersion: "v1",
|
|
kind: "Secret",
|
|
metadata: {
|
|
namespace: "quay-enterprise",
|
|
name: "quay-enterprise-config-secret"},
|
|
|
|
# base64 encode all files
|
|
data: { [file]: stack_files[file]
|
|
for file in std.objectFields(stack_files) if stack_files[file] != null}
|
|
}
|