Skip to content

Commit

Permalink
Fixes #13, Added extensions to devcontainer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
JolanThomassin committed Sep 12, 2023
1 parent 0ce5846 commit dc31e13
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
10 changes: 9 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@
],

// Configure tool-specific properties.
// "customizations": {},
"customizations": {
"vscode":{
"extensions": [
"timonwong.shellcheck",
"GitHub.vscode-pull-request-github",
"charliermarsh.ruff"
]
}
},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
Expand Down
35 changes: 19 additions & 16 deletions bin/lib.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
DIRNAME=$(dirname `realpath $0`)
#!/bin/bash
DIRNAME=$(dirname $(realpath $0))
PARENT_DIR=$DIRNAME/..
PROJECT_DIR=`realpath $PARENT_DIR`
PROJECT_DIR=$(realpath $PARENT_DIR)
ENV_FILE=$PROJECT_DIR/.env

if [ -f "$ENV_FILE" ]; then
. $ENV_FILE
# shellcheck source=lib.sh
. "$ENV_FILE"
else
echo "WARNING: File $ENV_FILE does not exist, relying on environment variables"
fi

check_environment_variables_defined () {
variable_not_set=0
for VARIABLE in "$@"; do
if [ -z "${!VARIABLE}" ]; then
echo "Environment variable $VARIABLE is not set"
variable_not_set=1
variable_not_set=0
for VARIABLE in "$@"; do
if [ -z "${!VARIABLE}" ]; then
echo "Environment variable $VARIABLE is not set"
variable_not_set=1
fi
done

if [ $variable_not_set -eq 1 ]; then
exit 1
fi
done

if [ $variable_not_set -eq 1 ]; then
exit 1
fi
}

export PGOPTIONS="--search_path=$LOUIS_SCHEMA,public"
Expand All @@ -33,16 +35,17 @@ export PGHOST
export PGPASSFILE
export PGPASSWORD

VERSION15=`psql --version | grep 15.`
VERSION15=$(psql --version | grep 15.)

if [ -z "$VERSION15" ]; then
echo "postgresql-client-15 required"
exit 1
fi

PSQL_ADMIN="psql -v ON_ERROR_STOP=1 --single-transaction -d $PGBASE"
TODAY=`date +%Y-%m-%d`
TODAY=$(date +%Y-%m-%d)

if [ -z "$PGDUMP_FILENAME" ]; then
PGDUMP_FILENAME=$PROJECT_DIR/dumps/$TODAY.$PGBASE.pg_dump
fi

export PSQL_ADMIN="psql -v ON_ERROR_STOP=1 --single-transaction -d $PGBASE"

0 comments on commit dc31e13

Please sign in to comment.