-
Notifications
You must be signed in to change notification settings - Fork 0
/
.envrc
33 lines (30 loc) · 1.19 KB
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
source_env_if_exists .local.env
source_env testing/v8serialize-echo
# Defines the echoservers tested in test/test_round_trip_with_v8.py
V8SERIALIZE_ECHOSERVERS=$(./scripts/list-echoservers.sh)
export V8SERIALIZE_ECHOSERVERS
# Get the name of the devcontainer volume if we are running in a devcontainer
# with a named volume as the workspace.
function workspace_volume_name() {
local CONTAINER_ID
CONTAINER_ID="$(hostname)"
# shellcheck disable=SC2016
local WORKSPACE_MOUNT_SOURCE_FMT='
{{- $source := "" }}
{{- range .HostConfig.Mounts }}
{{- if (and (eq .Type "volume") (eq .Target "/workspaces")) }}
{{- $source = .Source }}
{{- end }}
{{- end }}
{{- $source }}'
docker container inspect "$CONTAINER_ID" \
--format="$WORKSPACE_MOUNT_SOURCE_FMT" 2>/dev/null
}
# Enable the devcontainer compose config if we're in a devcontainer with a
# volume-mounted workspace.
V8SERIALIZE_DEVCONTAINER_VOLUME=$(workspace_volume_name)
if [[ "${V8SERIALIZE_DEVCONTAINER_VOLUME?}" ]]; then
export V8SERIALIZE_DEVCONTAINER_VOLUME
export WORKSPACE_MOUNT_PATH=/workspaces
export "COMPOSE_FILE=$(pwd)/docker-compose.yml:$(pwd)/docker-compose.devcontainer.yml"
fi