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
Copy file name to clipboardExpand all lines: packages/varlock-website/src/content/docs/env-spec/reference.mdx
+30-5Lines changed: 30 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ BAZ= # @dec # this is @ignored too
57
57
58
58
### Decorators
59
59
60
-
Decorators are used within comments to attach structured data to specific config items, or within a standalone comment blockto alter a group of items or the entire document and loading process.
60
+
Decorators are used within comments to attach structured data to specific config items, or within a standalone comment block to alter a group of items or the entire document and loading process.
61
61
62
62
- Each decorator has a name and optional value (`@name=value`) or is a bare function call `@func()`
63
63
- Decorators with values may only be used once per comment block, while function calls may be used multiple times
@@ -91,7 +91,7 @@ A divider is a comment that serves as a separator, like a `<hr/>` in HTML.
91
91
# ---
92
92
ITEM1=
93
93
ITEM2=
94
-
# --- another divider ---
94
+
# --- another divider ---
95
95
ITEM3=
96
96
```
97
97
@@ -100,9 +100,9 @@ ITEM3=
100
100
### Config Item Comments
101
101
Comment lines directly preceeding an item will be attached to that item, along with the decorators contained within.
102
102
103
-
- A blank line or a divider will break the above comments from being attached to the item
103
+
- A blank line or a divider will break the above comments from being attached to the item below
104
104
- Both decorator and regular comment lines may be interspersed
105
-
- Post-value comments may also contain decorators, but is not recommended
105
+
- Post-value comments may also contain decorators, but should be used sparingly
106
106
107
107
```env-spec
108
108
# these comments are attached to ITEM1 below
@@ -162,6 +162,7 @@ Values are interpreted similarly for config item values, decorator values, and v
162
162
- A value in quotes is _always_ treated as a string -- `@d1="with spaces"`, `@trueString="true"`, `@numStr="123"`
163
163
- All quote styles ``[`'"]`` are ok -- ``@dq="c" @bt=`b` @sq='a'``
164
164
- Escaped quotes matching the wrapping quote style are ok -- `@ok="escaped\"quote"`
165
+
- Single quote wrapped strings do not support [expansion (see below)](#expansion)
165
166
- In `"` or `` ` `` wrapped values, the string `\n` will be converted to an actual newline
166
167
- Multi-line strings may be wrapped in ``(```|"""|"|')``
167
168
- only available for config item values, not decorators or within function args
@@ -175,7 +176,7 @@ In each case, much of the handling is the same.
175
176
- a value must not be wrapped in quotes to be interpreted as a function call
176
177
- function names must start with a letter, and can then contain letters, numbers, and underscores `/[a-ZA-Z][a-ZA-Z0-9_]*/`
177
178
- you can pass no args, a single arg, or multiple args
178
-
- you may also pass key value pairs at the end of the list, and they will be combined into a single object at the end of the array
179
+
- you may also pass key value pairs at the end of the list
179
180
- each value will be interpreted using common value-handling rules (see above)
While the parser itself does not include any implemention of specific functions, it does handle _expansion_ of strings - and it uses several function calls under the hood to do so. This means a few basic function calls, while not implemented, have specific inherent meaning and must be implemented similarly across all tools that support this spec.
193
+
194
+
Expansion can be used within item values, decorator values, and function call arguments.
195
+
196
+
_Note that single quote wrapped strings are NOT expanded._
We recommend using expansion only for simple refs `$ITEM`/`${ITEM}` and skipping the rest.
207
+
208
+
- Use bracketed version within a larger string - `fn("${ENV}_db")`
209
+
- Skip the brackets otherwise - `fn($ENV)`
210
+
211
+
The rest is implemented to match other popular tools, but we do not recommend using them, as intent can be more clearly expressed using function calls directly.
0 commit comments