You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Variables are a great feature in D2, but it would be nice to be able to set values for the variables in other ways rather than directly in the .d2 file. In my case, I would like to reuse files for different diagrams, and having to create a new file with the values of the variables to import it from the main file is a bit inconvenient.
How about passing variables through environment variables in a similar fashion to Terraform variables?
E.g. to give bucket variable the value mybucket-1234 to be used when compiling a d2 file, do something like the following beforehand:
export D2_VAR_bucket="mybucket-1234"
I'd really appreciate your thoughts on this. Thanks in advance! 🙂
The text was updated successfully, but these errors were encountered:
My first instinct was to have source variables take precedent over env variables, but I think I'd want to flip that so that the source variable is the "default", and all referenced variables have to exist in the source vars in order to compile.
Maybe a simpler idea to start could be to allow an creation/override from d2 command line ?
Something like --extra-vars parameter in Ansible CLI ( --extra-vars "version=1.23.45 other_variable=foo)
Variables are a great feature in D2, but it would be nice to be able to set values for the variables in other ways rather than directly in the .d2 file. In my case, I would like to reuse files for different diagrams, and having to create a new file with the values of the variables to import it from the main file is a bit inconvenient.
How about passing variables through environment variables in a similar fashion to Terraform variables?
E.g. to give
bucket
variable the valuemybucket-1234
to be used when compiling a d2 file, do something like the following beforehand:I'd really appreciate your thoughts on this. Thanks in advance! 🙂
The text was updated successfully, but these errors were encountered: