This repository was archived by the owner on Jun 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathinput.go
More file actions
55 lines (42 loc) · 1.29 KB
/
input.go
File metadata and controls
55 lines (42 loc) · 1.29 KB
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
package packs
import (
"flag"
"os"
)
const (
EnvAppDir = "PACK_APP_DIR"
EnvAppZip = "PACK_APP_ZIP"
EnvAppName = "PACK_APP_NAME"
EnvAppURI = "PACK_APP_URI"
EnvAppDisk = "PACK_APP_DISK"
EnvAppMemory = "PACK_APP_MEM"
EnvAppFds = "PACK_APP_FDS"
EnvDropletPath = "PACK_DROPLET_PATH"
EnvSlugPath = "PACK_SLUG_PATH"
EnvMetadataPath = "PACK_METADATA_PATH"
EnvStackName = "PACK_STACK_NAME"
EnvUseDaemon = "PACK_USE_DAEMON"
EnvUseHelpers = "PACK_USE_HELPERS"
)
func InputDropletPath(path *string) {
flag.StringVar(path, "droplet", os.Getenv(EnvDropletPath), "file containing droplet")
}
func InputSlugPath(path *string) {
flag.StringVar(path, "slug", os.Getenv(EnvSlugPath), "file containing slug")
}
func InputMetadataPath(path *string) {
flag.StringVar(path, "metadata", os.Getenv(EnvMetadataPath), "file containing artifact metadata")
}
func InputStackName(image *string) {
flag.StringVar(image, "stack", os.Getenv(EnvStackName), "image repository containing stack image")
}
func InputUseDaemon(use *bool) {
flag.BoolVar(use, "daemon", boolEnv(EnvUseDaemon), "export to docker daemon")
}
func InputUseHelpers(use *bool) {
flag.BoolVar(use, "helpers", boolEnv(EnvUseHelpers), "use credential helpers")
}
func boolEnv(k string) bool {
v := os.Getenv(k)
return v == "true" || v == "1"
}