From 8d394cafd369bc28ff9fd099f012460c05227c1f Mon Sep 17 00:00:00 2001 From: Hyperling Date: Mon, 21 Aug 2023 12:14:53 -0700 Subject: [PATCH] Fix source file, BASH_SROUCE did not work without the shebang. Also fix bug for when it sees `..` and assumes current directory. --- dns.env.example | 4 ++++ source.env | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dns.env.example b/dns.env.example index c4d67c6..7cf86ca 100644 --- a/dns.env.example +++ b/dns.env.example @@ -4,6 +4,10 @@ # in. Therefore a local DNS is necessary in order to tell Nextcloud that the # document server is a local IP address rather than the WAN address like an # external DNS would. +# This file should be sourced by the shell instance starting the containers, it +# unfortunately cannot be specified in the env_file: element because the dns: +# element reads its variables before env_file: is loaded. Putting the servers +# into environment: works but then the configuration is no longer private. # A private DNS server, such as one run by this project's Config/DNS/ config. DNS1=10.110.1.53 diff --git a/source.env b/source.env index b242c68..46efd94 100755 --- a/source.env +++ b/source.env @@ -1,9 +1,11 @@ +#!/bin/bash # Provide any necessary project variables. # Needs run in the current shell environment, such as: -# source /PATH_TO_GIT_PROJECT/source.env +# source /PATH_TO_PROJECT/source.env DIR="$(dirname -- "${BASH_SOURCE[0]}")" -if [[ $DIR == \.* ]]; then +if [[ "$DIR" == '.'* ]]; then + cd $DIR DIR="`pwd`" fi @@ -12,3 +14,5 @@ DOCKER_PATH="$DOCKER_HOME/bin" PATH="$DOCKER_PATH:$PATH" export DOCKER_HOME DOCKER_PATH PATH + +source $DIR/dns.env