Configuration
This guide will help you to know the most important configuration options for the Block Headers Service.
Order of resolving configuration
The configuration is resolved in the following priority
Environment variables - the environment variables are prefixed with
BHS_
and are in uppercase. They have the highest priority when resolving the configuration. You can override any of the configuration options by setting the environment variable with the same name as the configuration option. For example, to override thehttp.port
configuration option, you can set theBHS_HTTP_PORT
environment variable.Configuration file - the configuration file is resolved next. The default configuration file is
config.yaml
in the working directory. You can also specify custom configuration file path using the-C
flag in the command line.If you don't specify the configuration file and environment variables, the default configuration will be used - it's resolved in
defaults.go
file in theconfig
package. Default configuration fromdefaults.go
is the same as the configuration fromconfig.example.yaml
.
Configuration File
There is an example of the configuration in a file called config.example.yaml
in the root of the project. You can copy this file to config.yaml
and modify it to your needs.
The most important configuration options are:
Going through highlighted options:
The
http
section contains theauth_token
which is used for admin api authentication. This key is used to authenticate the admin api calls.The
db
section contains theengine
section which can be set tosqlite
orpostgresql
. Thesqlite
is the default option. You can also define details about your database in this section.The
logging
section contains options which are used for logging. You can set thelevel
option todebug
,info
,warn
orerror
. Theformat
option can be set toconsole
orjson
. Theinstance_name
option is shown as a parameter in logs.The
metrics
section contains theenabled
option which is used to enable Prometheus metrics.
Last updated