Skip to content

Cue generate Yaml Configs #1266

Answered by verdverm
zombiebober asked this question in Q&A
Sep 21, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

I would use the following patterns, given you want to maintain the variables as Yaml. My personal preference would be to convert all inputs to CUE.

main.cue

// schemas
#Global: {
        host: string
}

#Mode: {
        user: string
}

// yaml vars validation
global: #Global
mode: [env=string]: #Mode

// "flags" for controlling selection
#env: string | *"dev" @tag(env)

// output mapping, uses the current "function" syntax for CUE
#Output: {
       // defines a top level input value, could have them individually
        #IN: {
                global: #Global
                vars: #Mode
        }

        // the result is where the actual mapping happens
        result: {
                l…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@zombiebober
Comment options

@verdverm
Comment options

Answer selected by zombiebober
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants