forked from xataio/pgroll
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow CLI flags to be specified by environment variable (xataio#152)
Bind command line arguments to env vars. Allow the flags: * `--postgres-url` * `--schema` * `--pgroll-schema` To be set via these env vars: * `PGROLL_PG_URL` * `PGROLL_SCHEMA` * `PGROLL_STATE_SCHEMA` If a flag is specified both via a CLI flag and an env var the CLI flag takes priority.
- Loading branch information
1 parent
bdddd3c
commit 3eae4ec
Showing
10 changed files
with
572 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package flags | ||
|
||
import ( | ||
"github.com/spf13/viper" | ||
) | ||
|
||
func PostgresURL() string { | ||
return viper.GetString("PG_URL") | ||
} | ||
|
||
func Schema() string { | ||
return viper.GetString("SCHEMA") | ||
} | ||
|
||
func StateSchema() string { | ||
return viper.GetString("STATE_SCHEMA") | ||
} | ||
|
||
func LockTimeout() int { | ||
return viper.GetInt("LOCK_TIMEOUT") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.