forked from bluesentry/bucket-antivirus-function
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.envrc
77 lines (62 loc) · 2.25 KB
/
.envrc
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#! /usr/bin/env bash
##########################################
# DO NOT MAKE LOCAL CHANGES TO THIS FILE #
# #
# Vars in this file can be overridden by #
# exporting them in .envrc.local #
##########################################
# Add local paths for binaries and scripts
PATH_add ./scripts
# ShellCheck complains about things like `foo=$(cmd)` because you lose the
# return value of `cmd`. That said, we're not using `set -e`, so we aren't
# really concerned about return values. The following `true`, applies the
# rule to the entire file.
# See: https://github.com/koalaman/shellcheck/wiki/SC2155
# shellcheck disable=SC2155
true
required_vars=()
var_docs=()
# Declare an environment variable as required.
#
# require VAR_NAME "Documentation about how to define valid values"
require() {
required_vars+=("$1")
var_docs+=("$2")
}
# Check all variables declared as required. If any are missing, print a message and
# exit with a non-zero status.
check_required_variables() {
for i in "${!required_vars[@]}"; do
var=${required_vars[i]}
if [[ -z "${!var}" ]]; then
log_status "${var} is not set: ${var_docs[i]}"
missing_var=true
fi
done
if [[ $missing_var == "true" ]]; then
log_error "Your environment is missing some variables!"
log_error "Set the above variables in .envrc.local and try again."
fi
}
#########################
# Project Configuration #
#########################
# Lamdba resource constraints (Override in .envrc.local)
# https://docs.docker.com/config/containers/resource_constraints/
export MEM=1024m
export CPUS=1.0
require AV_DEFINITION_S3_BUCKET "Add this variable to your .envrc.local"
require AV_DEFINITION_S3_PREFIX "Add this variable to your .envrc.local"
require TEST_BUCKET "Add this variable to your .envrc.local"
require TEST_KEY "Add this variable to your .envrc.local"
##############################################
# Load Local Overrides and Check Environment #
##############################################
# Load a local overrides file. Any changes you want to make for your local
# environment should live in that file.
if [ -e .envrc.local ]
then
source_env .envrc.local
fi
# Check that all required environment variables are set
check_required_variables