Skip to content

The injecuet injects concrete values and emits new CUE document.

License

Notifications You must be signed in to change notification settings

aereal/injecuet

Repository files navigation

status PkgGoDev

injecuet

injecuet (ɪndʒékjuːt) = inject + CUE

The injecuet injects concrete values and emits new CUE document.

You can pass emitted new CUE document as cue eval or cue export argument to generate unified CUE document or other format such as JSON or YAML. (See CUE integrations)

Current supported injection sources:

  • environment variables
  • Terraform state

Concept

The injecuet neither have type conversion mechanism nor data validation mechanism by design.

The CUE has Types are values concept, so you already get data validation mechanism from CUE.

For example, if you expected the injected values must not be empty, you just write != "" restriction and cue eval fails if injected value is empty.

You can also use CUE modules such as strconv to parse injected string as integers.

Synopsis

Environment variables

cat src.cue
# name: string @inject(env,name=USER_NAME)

env USER_NAME=aereal injecuet ./src.cue
# name: "aereal" @inject(env,name=USER_NAME)
cat complex.cue
# import "strconv"
# 
# #varAge: string @inject(env,name=AGE)
# age: strconv.Atoi(#varAge)

env AGE=17 injecuet -output ./out.gen.cue ./src.cue

cat out.gen.cue
# #varAge: "123"
# age:     123

cue export ./out.gen.cue
# {
#     "age": 123
# }

You can use injecuet with ssmwrap:

cat src.cue
# secretKey: string @inject(env,name=APP_SECRET_KEY)

ssmwrap -env-prefix APP_ -recursive injecuet ./src.cue
# secretKey: "<value from SSM parameter store>" @inject(env=APP_SECRET_KEY)

Terraform state

You can pass file path or URL to stateURL. Supported URL formats are described on tfstate-lookup.

See examples.

Installation

go get github.com/aereal/injecuet/cmd/injecuet

Library usage

The injecuet also provides library interface.

See pkg.go.dev

License

See LICENSE file.

About

The injecuet injects concrete values and emits new CUE document.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages