horizon
horizon copied to clipboard
Unable to call horizon db init with --db-url parameter
I was unable to init horizon db with --db-url parameter:
/horizon db init --db-url="postgres://localhost/horizon" Error: unknown flag: --db-url Run 'horizon help' for usage.
Confirmed. As a workaround you can use env variable:
DB_URL="postgres://localhost/horizon" ./bin/horizon db init
Great catch: The issue is related to the fact that we don't make the flags "persistent" in cobra terms: https://github.com/stellar/horizon/blob/master/src/github.com/stellar/horizon/cmd/horizon/main.go#L62
Should be pretty simple to fix.
Just hit this bug too. For future reference the environment variable you need to set is DATABASE_URL
and not DB_URL
Unix domain socket
DATABASE_URL="dbname=horizon user=stellar host=/var/run/postgresql" horizon db init
TCP connection
DATABASE_URL="postgres://localhost/horizon" horizon db init