Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates #713

Merged
merged 3 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/views/docs/en/reference/cli/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ templates

### `@env`

Architect Sandbox will load variables for Sandbox's current environment (`testing`, `staging`, or `production`) from a [local preferences file with `@env`](../configuration/local-preferences#%40env). If a project contains a `.env` file, Architect will load those variables _instead_.
Architect Sandbox will load variables for Sandbox's current environment (`testing`, `staging`, or `production`) from a [local preferences file with `@env`](../configuration/local-preferences#%40env). If a project contains a `.env` file, Architect will load those variables _instead_, and only for the `testing` environment.

Variables from local preference files and `.env` will **not** be merged. Further details, including the variable load-strategy are [outlined below](#environment-variables).

Expand All @@ -161,7 +161,7 @@ Using a [local preferences file with `@env`](../configuration/local-preferences#

### Example scenario

If `.env` is found, Sandbox will not load any variables from any Arc preferences. Given the following case with 3 environment variable sources:
If `.env` is found, Sandbox will only use the variables for the `testing` environment, and not load any variables from any Arc preferences files. Given the following case with 3 environment variable sources:

```bash
# ./.env
Expand Down
10 changes: 6 additions & 4 deletions src/views/docs/en/reference/configuration/function-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category: Configuration
description: Lambda function configuration
sections:
- 'env'
- 'ignoredDependencies'
- 'ignoreDependencies'
- 'shared'
- 'views'
- 'architecture'
Expand All @@ -25,7 +25,7 @@ Configure individual Lambda function properties (e.g. `src/http/get-index/config
Use the `@arc` pragma to disable Architect features for a specific function:

- [`env`](#env) - boolean, `true` (default) or `false` to disable loading environment variables
- [`ignoredDependencies`](#ignoredDependencies) - array, specific dependency names to ignore during Lambda treeshaking
- [`ignoreDependencies`](#ignoreDependencies) - array, specific dependency names to ignore during Lambda treeshaking
- [`shared`](#shared) - boolean, `true` (default) or `false` to skip hydrating project code from `@shared`.
- [`views`](#views) - boolean, `true` (default) or `false` to skip hydrating project code from `@views`.

Expand All @@ -35,7 +35,7 @@ Use the `@arc` pragma to disable Architect features for a specific function:
# src/function/dir/config.arc
@arc
env false
ignoredDependencies
ignoreDependencies
some-special-dependency
shared false
views false
Expand All @@ -48,10 +48,12 @@ Sometimes it's necessary to have an even more isolated, locked down Lambda withi
Note: even with `env` set to false, your function still has access to credentials with whatever IAM privileges the Lambda has been granted. To isolate permissions further, please see [`policies`](#policies).


### `ignoredDependencies`
### `ignoreDependencies`

Disable specific dependencies from being installed in Lambdas that rely on [automated dependency treeshaking](/docs/en/guides/developer-experience/dependency-management#automated-dependency-treeshaking). This setting is currently only supported in Node.js Lambdas.

The alternate spelling of `ignoredDependencies` may also be used, although `ignoreDependencies` is preferred.


### `shared`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ production

### `.env` file support

Architect sandbox supports loading environment variables from a `.env` file. The `.env` will override your `preferences.arc` or `prefs.arc` and environment variables it defines will be loaded for whichever environment the sandbox is running (`testing`, `staging`, or `production`).
Architect Sandbox supports loading environment variables from a `.env` file. The `.env` will override your `preferences.arc` or `prefs.arc`, and environment variables it defines are only loaded for the `testing` environment. If you require locally configured env vars for `staging` or `production` environments, you must use `pref[erence]s.arc`.

(NB: Recall that key/value pairs in `.env` files are separated by the `=` symbol)
Note: as a friendly reminder, key / value pairs in `.env` files are separated by the `=` symbol.

### Example `.env` file

Expand All @@ -78,6 +78,7 @@ A_TESTING_ENV_VAR=something-for-testing
ANOTHER_VAR=only-for-testing
```


## `@sandbox`

Define [Sandbox](../cli/sandbox) preferences. If you are not using a `.env` file then any environment variables set using the [`arc env` CLI](../cli/env) will be stored in the preferences file. In this scenario it is best _not_ to revision the preferences file in source control.
Expand Down