Skip to content

Commit 364538f

Browse files
Apply suggestions from code review
Co-authored-by: Phil Miller <[email protected]>
1 parent a581d24 commit 364538f

File tree

8 files changed

+20
-21
lines changed

8 files changed

+20
-21
lines changed

packages/varlock-website/src/content/docs/guides/environments.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ One of the main benefits of using environment variables is the ability to boot y
88
You may use both [functions](/reference/functions/) and/or environment-specific `.env` files (e.g., `.env.production`) to alter configuration accordingly in a declarative way. Plus the additional guardrails provided by `varlock` also make this much safer no matter where values come from.
99

1010
:::tip[environment-specific files are optional]
11-
While many have traditionally shied away from using environment-specific `.env` files due to fear of committing sensitive values, the new ability to set values using [plugins](/guides/plugins/) now makes it much easier to collaboratively manage these values in a secure way.
11+
While many have traditionally shied away from using environment-specific `.env` files due to fear of committing sensitive values, the ability to set values using [plugins](/guides/plugins/) makes it easier to securely, and collaboratively, manage these values.
1212

13-
Whether you want to use environment-specific files, exclusively use functions, or use a mix is totally up to you. Varlock tries to provide a toolkit to let you manage your config however you best see fit.
1413
:::
1514

1615

@@ -19,16 +18,16 @@ Whether you want to use environment-specific files, exclusively use functions, o
1918

2019
Sometimes you also may want to pass in env vars via the command line while running a command (e.g. `APP_ENV=prod pnpm run build`).
2120

22-
However we recommend using injected overrides sparingly, and instead moving more config into your `.env` files.
21+
However, we recommend using injected overrides sparingly, and instead moving more config into your `.env` files.
2322

2423

2524
### Loading environment-specific `.env` files
2625

27-
`varlock` automatically detects all `.env.*` files in the current directory. However any environment-specific files (e.g., `.env.development`) will only be loaded if they match the value of the _current environment_ as set by the [`@currentEnv`](/reference/root-decorators/#currentEnv) root decorator in your `.env.schema` file.
26+
`varlock` automatically detects all `.env.*` files in the current directory. However, any environment-specific files (e.g., `.env.development`) will only be loaded if they match the value of the _current environment_ as set by the [`@currentEnv`](/reference/root-decorators/#currentEnv) root decorator in your `.env.schema` file.
2827

2928
The files are applied with a specific precedence (increasing):
3029
- `.env.schema` - your schema file, which can also contain default values
31-
- `.env` - will be loaded, but not recommended
30+
- `.env` - will be loaded, but not recommended, instead use something more specific
3231
- `.env.[currentEnv]` - environment-specific values
3332
- `.env.local` - local overrides (gitignored)
3433
- `.env.[currentEnv].local` - environment-specific local overrides (gitignored)

packages/varlock-website/src/content/docs/guides/plugins.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ You may omit the version specifier only if your project has a `package.json` fil
4242
```
4343

4444
:::caution[Only `@varlock/*` plugins supported for now]
45-
For now, only official Varlock plugins under the `@varlock` npm scope are supported. We plan to support third-party plugins in the future, along with additional plugin source types (e.g., jsr, git, http, etc.) - but need additional security measures in place first.
45+
For now, only official Varlock plugins under the `@varlock` npm scope are supported. We plan to support third-party plugins in the future, along with additional plugin source types (e.g., jsr, git, http, etc.).
4646
:::
4747

4848
{/*
@@ -59,10 +59,10 @@ Plugins are loaded globally, and the additional functionality they provide will
5959

6060
Note that plugins will not be loaded from an inactive file - for example an environment-specific file that does not match the current environment, or one that uses the [`@disable` root decorator](/reference/root-decorators/#disable).
6161

62-
No specific namespacing or prefixes are enforced, and any naming conflicts will trigger an error, but plugins will use fairly specific names to avoid conflicts.
62+
No specific namespacing or prefixes are enforced, and any naming conflicts will trigger an error, but plugins will use specific names to avoid conflicts.
6363

6464
## Initialization
65-
Plugins are initialized using custom root decorators that they introduce. In some cases no specific initialization is needed, and in others, you may need to intialize multiple instances of a plugin with different options, referred to by some identifier. How (or if) a plugin needs to be initialized depends on the specific plugin and can depend on the the external service's data/auth model.
65+
Plugins are initialized using custom root decorators that they introduce. In some cases, no specific initialization is needed, and in others, you may need to initialize multiple instances of a plugin with different options, referred to by some identifier. How (or if) a plugin needs to be initialized depends on the specific plugin and can depend on the the external service's data/auth model.
6666

6767
A plugin initialization root decorator is used to set IDs, toggle features, and wire up auth. Note that sensitive data should be passed in via references to config items within your schema.
6868

@@ -77,7 +77,7 @@ OP_TOKEN=
7777
### Multiple plugin instances
7878
In secret storage tools, you should segment your data to follow the [_principle of least privilege_](https://en.wikipedia.org/wiki/Principle_of_least_privilege), so that different environments/services/devs only have access to the minimal secrets they need. At the very least, this usually means splitting your extra sensitive prod secrets from everything else, but it can be as fine-grained as needed.
7979

80-
We cannot always assume that you won't need access to multiple segments at the same time. In these cases, a plugin may be designed to be initialized multiple times with some kind of id parameter. Resolver functions and decorators can then accept an additional parameter to specify which instance to use. It is up to the plugin author to structure this in a way that makes sense.
80+
We cannot always assume that you won't need access to multiple segments at the same time. In these cases, a plugin may be designed to be initialized multiple times with some kind of id parameter. Resolver functions and decorators can then accept an additional parameter to specify which instance to use.
8181

8282

8383
```env-spec title=".env.schema" "@initOpVault" /id=[a-z]+/ /\\((dev),/

packages/varlock-website/src/content/docs/guides/schema.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ More details:
8484

8585
You may use [resolver functions](/reference/functions/) instead of static values within both config items and decorator values.
8686

87-
Functions may be composed together to create complex value resolution logic.
87+
Functions may be composed together to create more complex value resolution logic.
8888

8989
```env-spec
9090
# @required=forEnv(prod)
@@ -110,7 +110,6 @@ MY_KEY=exec(`op read "op://${OP_VAULT_NAME}/service/api-key"`)
110110
```
111111

112112
More details:
113-
- [Functions reference](/reference/functions/)
114113

115114

116115

packages/varlock-website/src/content/docs/plugins/1password.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Steps, Icon } from '@astrojs/starlight/components';
77

88
Our [1Password](https://1password.com/) plugin enables secure loading of values from 1Password vaults using declarative instructions within your `.env` files.
99

10-
For local development, it (optionally) supports authenticating using the local 1Password desktop app, including using biometric unlock. Otherwise it uses a [service account](https://developer.1password.com/docs/service-accounts/) making it suitable for CI/CD and production environments.
10+
For local development, it (optionally) supports authenticating using the local 1Password desktop app, including using biometric unlock. Otherwise, it uses a [service account](https://developer.1password.com/docs/service-accounts/) making it suitable for CI/CD and production environments.
1111

1212
This plugin is compatible with any 1Password account type (personal, family, teams, business), but note that [rate limits](https://developer.1password.com/docs/service-accounts/rate-limits/) vary by account type.
1313

@@ -49,7 +49,7 @@ If you already use 1Password and your secrets live in a vault that holds other s
4949

5050
</Steps>
5151

52-
This service account token will now serve as your _secret-zero_ - which grants access to the rest of your sensitive data stored in 1Password. It must be set locally (unless relying on app-based auth) and in any deployed environments, usually as an environment variable with your platform's UI.
52+
This service account token will now serve as your _secret-zero_ - which grants access to the rest of your sensitive data stored in 1Password. It must be set locally (unless relying on app-based auth) and in any deployed environments, usually as an environment variable with your platform's env var management UI.
5353

5454
:::tip[Vault organization best practices]
5555
Consider how you want to organize your vaults and service accounts, keeping in mind [best practices](https://support.1password.com/business-security-practices/#access-management-and-the-principle-of-least-privilege). At a minimum, we recommend having a vault for highly sensitive production secrets and another for everything else.

packages/varlock-website/src/content/docs/plugins/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Varlock plugins overview
55

66
Plugins allow extending the functionality of Varlock. See the [plugins guide](/guides/plugins/) for more details on using plugins.
77

8-
For now, only official Varlock plugins under the `@varlock` npm scope are supported. We plan to support third-party plugins in the future, along with loading plugins from different sources (e.g., local files, git, npm/jsr, http, etc.) - but need additional security measures in place first.
8+
For now, only official Varlock plugins under the `@varlock` npm scope are supported. We plan to support third-party plugins in the future, along with loading plugins from different sources (e.g., local files, git, npm/jsr, http, etc.).
99

1010
## Official plugins
1111
- [1Password](/plugins/1password/)

packages/varlock-website/src/content/docs/reference/functions.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: A comprehensive reference of all available function resolvers in va
55

66
You may use _resolver functions_ instead of static values within both config items and decorator values.
77

8-
Functions can be composed together to create complex value resolution logic.
8+
Functions can be composed together to create more complex value resolution logic.
99
```env-spec
1010
ITEM=fn(arg1, arg2)
1111
COMPOSITION=fn1(fn1Arg1, fn2(fn2Arg1, fn2Arg2))
@@ -24,14 +24,14 @@ CONFIG=exec(`aws ssm get-parameter --name "/config/${APP_ENV}" --with-decryption
2424

2525
Currently, there are built-in utility functions, and soon there will be functions to handle values encrypted using varlock provided tools.
2626

27-
Plugins may also register additional resolvers - which can be used to generate and transform values, or even fetch data from external providers.
27+
Plugins may also register additional resolvers - which can be used to generate and transform values, or fetch data from external providers.
2828

2929

3030
<div class="reference-docs">
3131
<div>
3232
### `ref()`
3333

34-
References another config item (env var) - which is very useful when composing multiple functions together.
34+
References another config item (env var) - which is useful when composing multiple functions together.
3535

3636
Expansion equivalent: `ref(OTHER_VARL)` === `${OTHER_VAR}` (and also `$OTHER_VAR`)
3737

@@ -152,7 +152,7 @@ DEBUG_FLAG=
152152
<div>
153153
### `eq()`
154154

155-
Checks if 2 values are equal and resvolves to a boolean.
155+
Checks if 2 values are equal and resolves to a boolean.
156156

157157
```env-spec "regex"
158158
IS_STAGING_DEPLOYMENT=eq($GIT_BRANCH, "staging")

packages/varlock-website/src/content/docs/reference/item-decorators.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@ SECRET_KEY=
103103

104104
<div>
105105
### `@docs()`
106-
URL of documentation related to the item.
106+
URL of documentation related to the item. Can be called multiple times.
107107

108108
```env-spec
109-
# @docsUrl=https://platform.openai.com/docs/api-reference/authentication
109+
# @docs(https://platform.openai.com/docs/api-reference/authentication)
110+
# @docs(https://platform.openai.com/docs/api-reference/security)
110111
OPENAI_API_KEY=
111112
```
112113
</div>

packages/varlock-website/src/content/docs/reference/root-decorators.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ More details of the minutiae of decorator handling can be found in the [@env-spe
2727
### `@currentEnv`
2828

2929
Sets the current _environment_ value, which will be used when determining if environment-specific .env files will be loaded (e.g. `.env.production`),
30-
and also may affect other dynamic behaviour in your schema, such as the [`forEnv()` function](/reference/functions/#forenv). We often refer to the name of this item as your _environment flag_.
30+
and also may affect other dynamic behaviour in your schema, such as the [`forEnv()` function](/reference/functions/#forenv). We refer to the name of this item as your _environment flag_.
3131

3232
This will usually be something like `@currentEnv=$APP_ENV`.
3333

0 commit comments

Comments
 (0)