Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit 11a2c55

Browse files
committed
Add some new hosts and add docker context config support.
1 parent e05d7b4 commit 11a2c55

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Diff for: config.json

223 Bytes
Binary file not shown.

Diff for: configScripts/update-docker-context.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -e
3+
4+
mapfile -t HOSTS < <(jq -r '.dockerContexts[][1]' config.json)
5+
mapfile -t NAMES < <(jq -r '.dockerContexts[][0]' config.json)
6+
7+
index=0
8+
while [ "x${HOSTS[index]}" != "x" ]; do
9+
# Since everything in this repo is idempotent, but since docker context
10+
# returns a non-zero exit code if a context already exists (strange choice
11+
# on their end, but I kind of see it), we temporarily allow failures for
12+
# this command. This does have the possibility of hiding a legitimate
13+
# error, but I'm too lazy to make this script any fancier.
14+
set +e
15+
docker context create "${NAMES[index]}" --docker "${HOSTS[index]}"
16+
set -e
17+
index=$(( index + 1 ))
18+
done
19+
20+
21+
./print.sh "Docker contexts updated!"

Diff for: sample-config.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"email": "[email protected]",
33
"name": "Your Name",
44
"hosts": [],
5+
"dockerContexts": [],
56
"sublimeLicense": null,
67
"borgRepo": null,
78
"installThingsWithEncryptedDeps": false
8-
}
9+
}

0 commit comments

Comments
 (0)