Skip to content

Commit

Permalink
fix: maildev value compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
matmut7 committed Jan 30, 2024
1 parent 5a0c2b9 commit 4aedc6c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 20 deletions.
48 changes: 48 additions & 0 deletions plugins/contrib/values-compilers/09-maildev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
function isMaildevComponent(component) {
return component[`~chart`]?.endsWith(".contrib.maildev")
}

function extractMaildevComponents(values, acc = []) {
Object.entries(values).forEach(([key, component]) => {
if (typeof component === "object" && component !== null) {
extractMaildevComponents(component, acc)
if (component._isChartValues && isMaildevComponent(component)) {
acc.push([key, component])
}
}
})
return acc
}

const maildev = async (values, _options, { _config, utils, _ctx }) => {
console.log("maildev", values)
const { deepmerge } = utils

const components = extractMaildevComponents(values)

components.forEach(([key, component]) => {
const persistenceEnabled =
component.persistence.enabled !== null
? component.persistence.enabled
: !!values.global.env.preprod

/** @type {import("./09-maildev-schema").MailDevSchema} */
const maildevValues = {
host: component.host || `${key}-${values.global.host}`,
repositoryName: values.global.repositoryName,
ingress: {
annotations: values.global.ingress.annotations,
},
persistence: {
enabled: persistenceEnabled,
},
cron: {
enabled: persistenceEnabled,
},
}

deepmerge(component, maildevValues)
})
}

module.exports = maildev
8 changes: 0 additions & 8 deletions plugins/fabrique/charts/maildev/Chart.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions plugins/fabrique/charts/maildev/values.yaml

This file was deleted.

1 change: 1 addition & 0 deletions plugins/fabrique/values-compilers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ module.exports = [

"./global-defaults.js",

"../charts/contrib/values-compilers/09-maildev.js",
"../charts/contrib/values-compilers/10-tpl-meta-values",
]
2 changes: 0 additions & 2 deletions plugins/fabrique/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ pg:
enabled: false
pgweb:
enabled: false
maildev:
enabled: false
keycloakx:
enabled: false
contrib:
Expand Down

0 comments on commit 4aedc6c

Please sign in to comment.