Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: config as second arg #793

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/pbackend/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@

func api() {
ctx := context.Background()
config.Initialize("config/api.env")
cfgs := []string {

Check failure on line 34 in cmd/pbackend/api.go

View workflow job for this annotation

GitHub Actions / 🏫 Go linter

File is not `gofmt`-ed with `-s` (gofmt)
"config/api.env",
}
if len(os.Args) == 3 {
cfgs = append(cfgs, os.Args[2])
}
config.Initialize(cfgs...)

// initialize cloudwatch using the AWS clients
logger, closeFunc := logging.InitializeLogger()
Expand Down
2 changes: 1 addition & 1 deletion cmd/pbackend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func main() {
}

func usage() {
fmt.Println("Usage: pbackend [migrate|api|worker|statuser|stats|update|version]")
fmt.Println("Usage: pbackend [migrate|api|worker|statuser|stats|update|version] [alternate_env_file]")
os.Exit(1)
}

Expand Down
9 changes: 8 additions & 1 deletion cmd/pbackend/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@

func migrate() {
ctx := context.Background()
config.Initialize("config/api.env", "config/migrate.env")
cfgs := []string {

Check failure on line 16 in cmd/pbackend/migrate.go

View workflow job for this annotation

GitHub Actions / 🏫 Go linter

File is not `gofmt`-ed with `-s` (gofmt)
"config/api.env",
"config/migrate.env",
}
if len(os.Args) == 3 {
cfgs = append(cfgs, os.Args[2])
}
config.Initialize(cfgs...)

// initialize stdout logging and AWS clients first (cloudwatch is not available in init containers)
logging.InitializeStdout()
Expand Down
9 changes: 8 additions & 1 deletion cmd/pbackend/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@

func stats() {
ctx := context.Background()
config.Initialize("config/api.env", "config/stats.env")
cfgs := []string {

Check failure on line 26 in cmd/pbackend/stats.go

View workflow job for this annotation

GitHub Actions / 🏫 Go linter

File is not `gofmt`-ed with `-s` (gofmt)
"config/api.env",
"config/stats.env",
}
if len(os.Args) == 3 {
cfgs = append(cfgs, os.Args[2])
}
config.Initialize(cfgs...)

// initialize cloudwatch using the AWS clients
logger, closeFunc := logging.InitializeLogger()
Expand Down
9 changes: 8 additions & 1 deletion cmd/pbackend/statuser.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,14 @@ func sendResults(cancelCtx context.Context, batchSize int, tickDuration time.Dur

func statuser() {
ctx := context.Background()
config.Initialize("config/api.env", "config/statuser.env")
cfgs := []string {
"config/api.env",
"config/statuser.env",
}
if len(os.Args) == 3 {
cfgs = append(cfgs, os.Args[2])
}
config.Initialize(cfgs...)

// initialize cloudwatch using the AWS clients
logger, closeFunc := logging.InitializeLogger()
Expand Down
9 changes: 8 additions & 1 deletion cmd/pbackend/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ import (

func worker() {
ctx := context.Background()
config.Initialize("config/api.env", "config/worker.env")
cfgs := []string {
"config/api.env",
"config/worker.env",
}
if len(os.Args) == 3 {
cfgs = append(cfgs, os.Args[2])
}
config.Initialize(cfgs...)

// initialize stdout logging and AWS clients first
logging.InitializeStdout()
Expand Down
Loading