aboutsummaryrefslogtreecommitdiff
path: root/.envrc
blob: 89d8608533f23051ef86d4eb1ecd6b2654562067 (plain) (blame)
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
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
set -Eeuo pipefail

#
# Operational toggle
#
export DESTROY_VOLUME=

#
# Variables defined by commands
#
VPS_COMMIT_SHA="$(cat .git/refs/heads/master)"
export VPS_COMMIT_SHA
# Used for keeping bash variables for run-time substituion instead of execution time substitution.
# Taken from:
# https://stackoverflow.com/questions/24963705/is-there-an-escape-character-for-envsubst
export DOLLAR='$'

#
# docker-compose
#
export VOLUME_HOME="/home/vps/volumes"

#
# Nix
#
# Use the same $NIX_PATH as in the CI
# See also:
# https://discourse.nixos.org/t/inconsistent-hash-of-buildgomodule/3127/4
export NIX_PATH=nixpkgs=channel:nixos-unstable

if [[ "$(file -b ./secrets/secret-envrc.sh 2> /dev/null)" = "data" ]];
then
  echo 'The ./secrets/secret-envrc.sh is encrypted, not sourcing it.'
  return
fi

SSH_SERVER_PRIVATE_KEY="$(cat ./secrets/ssh/vps-box-server)"
export SSH_SERVER_PRIVATE_KEY
SSH_SERVER_PUBLIC_KEY="$(cat ./secrets/ssh/vps-box-server.pub)"
export SSH_SERVER_PUBLIC_KEY

source ./secrets/secret-envrc.sh