Skip to content

Commit

Permalink
Panic if user is using -envfile flag
Browse files Browse the repository at this point in the history
  • Loading branch information
latenssi committed Jan 31, 2022
1 parent 34d752f commit f5cd3ba
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ docker-compose down

## Configuration

The application is configured using _environment variables_.

If you have an existing `.env` file (or you were using `-envfile`) you can run a command with the variables loaded:

# Replace <command> with the command you want to run
env $(grep -e '^#' .env | xargs) <command>

# For example
env $(grep -e '^#' .env | xargs) go run main.go

### Maintenance mode

You can put the service in maintenance mode via the [System API](https://flow-hydraulics.github.io/flow-wallet-api/#tag/System) by sending the following JSON body as a `POST` request to `/system/settings` (example in [api-test-scripts/system.http](api-test-scripts/system.http)):
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ require (
github.com/google/uuid v1.3.0
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/jackc/pgx/v4 v4.14.1 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/jpillora/backoff v1.0.0
github.com/lib/pq v1.10.4
github.com/onflow/cadence v0.20.1
Expand Down Expand Up @@ -72,6 +70,7 @@ require (
github.com/jackc/pgx/v4 v4.14.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.4 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/mattn/go-sqlite3 v1.14.10 // indirect
github.com/onflow/atree v0.1.0-beta1.0.20211027184039-559ee654ece9 // indirect
Expand Down
12 changes: 10 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,20 @@ var (
)

func main() {
var printVersion bool
var (
printVersion bool
envFilePath string // LEGACY: now used to check if user still is using envFilePath
)

// If we should just print the version number and exit
flag.BoolVar(&printVersion, "version", false, "if true, print version and exit")

flag.StringVar(&envFilePath, "envfile", "", "deprecated")
flag.Parse()

if envFilePath != "" {
panic("'-envfile' is no longer supported, see readme")
}

if printVersion {
fmt.Printf("v%s build on %s from sha1 %s\n", version, buildTime, sha1ver)
os.Exit(0)
Expand Down

0 comments on commit f5cd3ba

Please sign in to comment.