forked from refiito/pipes-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags.go
29 lines (23 loc) · 902 Bytes
/
flags.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
package main
import (
"os"
"github.com/namsral/flag"
)
var (
port int
workdir string
bugsnagAPIKey string
environment string
dbConnString string
testDBConnString string
)
func InitFlags() {
fs := flag.NewFlagSetWithEnvPrefix(os.Args[0], "PIPES_API", flag.ExitOnError)
fs.IntVar(&port, "port", 8100, "port")
fs.StringVar(&workdir, "workdir", ".", "Workdir of server")
fs.StringVar(&bugsnagAPIKey, "bugsnag_key", "", "Bugsnag API Key")
fs.StringVar(&environment, "environment", "development", "Environment")
fs.StringVar(&dbConnString, "db_conn_string", "dbname=pipes_development user=pipes_user host=localhost sslmode=disable port=5432", "DB Connection String")
fs.StringVar(&testDBConnString, "test_db_conn_string", "dbname=pipes_test user=pipes_user host=localhost sslmode=disable port=5432", "test DB Connection String")
fs.Parse(os.Args[1:])
}