Skip to content

Example of passing environment variables from cli #1055

Answered by bioball
BusyByte asked this question in Q&A
Discussion options

You must be logged in to vote

Your syntax for variable interpolation is incorrect:

-"${COMPONENT}"
+"\(COMPONENT)"

You actually don't even need interpolation here, because COMPONENT is already a string. So it can just be component = List(COMPONENT).

In case you aren't already, I highly recommend using one of our editor plugins for writing Pkl, because it they will provide feedback about this to you.

Some other notes:

  1. List is a data type that's meant for in-language operations (map/flatmap/filter/etc). If you want to describe data, you should use Listing.

  2. If your module only makes sense as JSON, you should go ahead and set the output.renderer. Then, you don't need to add -f json anymore as a CLI flag.

    output {
      re…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@BusyByte
Comment options

Answer selected by BusyByte
Comment options

You must be logged in to vote
1 reply
@bioball
Comment options

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