-
Notifications
You must be signed in to change notification settings - Fork 9
Configuration
-
By default, the server read all configs from command line flags.
-
If flag
-conf={FILE}
is set, the server will load configs from{FILE}
instead of flags. Refer toconfig.example.yml
for detail. -
If the environment variable
USE_ENV_CONFIG=true
is set, the non-empty environment variable will override corresponding fields. Refer toexample.env
for detail.
Note: we are using environment variable fields' names here, you can easily map them to config files' or command flags' names by reading config.example.yml
or ./goldennum -h
.
-
Set bind to
HOST:PORT
,HOST
should be set to0.0.0.0
if you want to receive outside connections. -
Base URL is useful when hosting multiple services under the same domain. In other words, the Goldennum server is not hosted at the root (
/
).For example, you are hosting your website at
example.com
, and using a reverse proxy to redirecthttps://example.com/goldennum/${uri}
tohttp://localhost:8080/${uri}
, where you host your server at.Then, you need to set
BASE_URL
to/goldennum
, then the server knows to add prefix/goldennum
for frontend statics URL, API paths...
-
Admin port uses HTTP Basic Auth, you need to set a username and password for it.
-
If
password
is empty, a safe random token will be used.
-
DB_TYPE=sqlite3
-
DB_PATH
sets the database path.You may also set it to
file::memory:?cache=shared
for an in-memory database when debugging. But be aware of shutting down the server will let you lost all of the data since SQLite3 will wipe it off when no connection is alive.
-
DB_TYPE=mysql
-
DB_ADDR
is the database server address with port,localhost:3306
, eg. -
DB_USER
,DB_PASSWORD
,DB_NAME
for database username, password, name.
Note: you may not need to change those default settings.
-
MAX_CONNS
, max open connections, default to 150. -
MAX_IDLES
, max idle connections, should be <=MAX_CONNS
, default toMAX_CONNS * 0.25
. -
CONN_LIFE
, how long can one connection keeps alive, default to 5.
- Set
DEBUG
totrue
to enable debugging.