This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vars.go
61 lines (43 loc) · 1.43 KB
/
vars.go
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
package env
import "os"
var envVars = []string{
"PARALLEL", "CONCURRENCY", "USE_BUFFERED_STREAM", "CONCURENCY_LIMIT",
"BUCKET", "ACCESS_KEY_ID", "SECRET_ACCESS_KEY", "SESSION_TOKEN", "ENDPOINT", "REGION",
"AWS_BUCKET", "AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "AWS_ENDPOINT", "AWS_REGION",
"COMPRESSION", "FILE_MAX_ROWS", "SAMPLE_SIZE",
"KEY_FILE", "KEY_BODY", "CRED_API_KEY",
"GC_BUCKET", "GOOGLE_APPLICATION_CREDENTIALS", "GSHEETS_CRED_FILE",
"GC_KEY_BODY", "GC_CRED_API_KEY",
"ACCOUNT", "CONTAINER", "SAS_SVC_URL", "CONN_STR",
"AZURE_ACCOUNT", "AZURE_KEY", "AZURE_CONTAINER", "AZURE_SAS_SVC_URL",
"AZURE_CONN_STR",
"SSH_TUNNEL", "SSH_PRIVATE_KEY", "SSH_PUBLIC_KEY",
"SMTP_HOST", "SMTP_PORT", "SMTP_USERNAME", "SMTP_PASSWORD", "SMTP_FROM_EMAIL", "SMTP_REPLY_EMAIL",
"HTTP_USER", "HTTP_PASSWORD", "GSHEET_CLIENT_JSON_BODY",
"GSHEET_SHEET_NAME", "GSHEET_MODE",
"DIGITALOCEAN_ACCESS_TOKEN", "GITHUB_ACCESS_TOKEN",
"SURVEYMONKEY_ACCESS_TOKEN",
"SEND_ANON_USAGE", "DBIO_HOME",
}
// Vars are the variables we are using
func Vars() (vars map[string]string) {
vars = map[string]string{}
// get default from environment
for _, k := range envVars {
val := os.Getenv(k)
if vars[k] == "" && val != "" {
vars[k] = val
}
}
// default as true
for _, k := range []string{} {
if vars[k] == "" {
vars[k] = "true"
}
}
if vars["SAMPLE_SIZE"] == "" {
vars["SAMPLE_SIZE"] = "900"
}
return
}