Skip to content

Commit 7d4ebdf

Browse files
env vars
1 parent 2e3063c commit 7d4ebdf

File tree

6 files changed

+27
-17
lines changed

6 files changed

+27
-17
lines changed

src/devcontainers/loaded/.devcontainer/devcontainer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"image": "ghcr.io/nhsdigital/nhs-notify-devcontainer-base:latest",
33
"features": {
4-
"ghcr.io/nhsdigital/nhs-notify-devcontainers/nhsnotify:1.0.1": {
4+
"ghcr.io/nhsdigital/nhs-notify-devcontainers/nhsnotify:1.0": {
55
"updateFromTemplate": true,
66
"showWelcome": true
77
}
@@ -12,5 +12,10 @@
1212
"forwardPorts": [
1313
4000
1414
],
15-
"name": "NHS Notify Fully Loaded Developer Container"
15+
"name": "NHS Notify Fully Loaded Developer Container",
16+
17+
"containerEnv": {
18+
"UPDATEFROMTEMPLATE": "true",
19+
"SHOWWELCOME": "true"
20+
}
1621
}

src/devcontainers/loaded/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ build:
77
devcontainer build \
88
--push false \
99
--workspace-folder $(WORKSPACE_FOLDER) \
10-
--image-name "$(IMAGE_NAME)"
10+
--image-name "$(IMAGE_NAME)" \
11+
--no-cache \
12+
--label "devcontainer.metadata=[{\"containerEnv\": { \"CUSTOM_VARIABLE\": \"Testing a variable\" }}]"
13+

src/features/nhsnotify/devcontainer-feature.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2+
"containerEnv": {
3+
"UPDATEFROMTEMPLATE": "true",
4+
"SHOWWELCOME": "true"
5+
},
26
"dependsOn": {
37
"ghcr.io/devcontainers/features/python:1.7.1": {
48
"version": "3.13.8",
@@ -45,7 +49,7 @@
4549
"name": "NHS Notify",
4650
"postCreateCommand": "zsh /usr/local/share/nhsnotify/scripts/postcreatecommand.sh",
4751
"postStartCommand": "zsh /usr/local/share/nhsnotify/scripts/poststartcommand.sh",
48-
"version": "1.0.1",
52+
"version": "1.0.3",
4953
"customizations": {
5054
"vscode": {
5155
"extensions": [
@@ -99,18 +103,6 @@
99103
}
100104
}
101105
},
102-
"options": {
103-
"updateFromTemplate": {
104-
"type": "boolean",
105-
"description": "Update from template",
106-
"default": true
107-
},
108-
"showWelcome": {
109-
"type": "boolean",
110-
"description": "Show welcome message",
111-
"default": true
112-
}
113-
},
114106
"mounts": [
115107
{
116108
"source": "/usr/local/share/ca-certificates",

src/features/nhsnotify/install.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
SHARE_DIR="/usr/local/share/nhsnotify"
23

34
add_asdf_to_path(){
45
echo "adding asdf to path"
@@ -8,7 +9,7 @@ add_asdf_to_path(){
89

910
echo "Starting NHS Notify feature installation script"
1011

11-
SHARE_DIR="/usr/local/share/nhsnotify"
12+
1213
echo "Share dir is $SHARE_DIR"
1314
mkdir -p $SHARE_DIR
1415
cp -r ./scripts $SHARE_DIR
@@ -24,5 +25,10 @@ echo "APT packages configured"
2425
echo "go is at $(which go)"
2526
echo 'install asdf via go'
2627
go install github.com/asdf-vm/asdf/cmd/[email protected]
28+
29+
2730
add_asdf_to_path
31+
32+
33+
2834
echo "Finished NHS Notify feature installation script"

src/features/nhsnotify/scripts/postcreatecommand.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22
CURRENT_DIR=$(pwd)
3+
4+
echo "Starting post create command script"
5+
echo "Update from template variable is set to: ${UPDATEFROMTEMPLATE}"
36
update_from_template="${UPDATEFROMTEMPLATE:-true}"
47

58
REPO=https://github.com/NHSDigital/nhs-notify-repository-template.git

src/features/nhsnotify/scripts/welcome.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
# Check if SHOWWELCOME is set to true, exit if not
4+
echo "Show welcome variable is set to: ${SHOWWELCOME}"
45
show_welcome="${SHOWWELCOME:-true}"
56
if [ "${show_welcome}" != "true" ]; then
67
exit 0

0 commit comments

Comments
 (0)