Server Configuration
There are two methods for configuring the sever. Either by using a configuration file, or environment variables. Select between the two tabs to show examples of which source you require.
Configuration Sources
TOML
There are a few default locations that the server will look for configuration files
- /etc/warecache/config.toml
- ~/.local/config/warecache/config.toml
- ./wcd_config.toml
The more local the file is, the higher the precedence in settings. An example configuration file is shown below.
[general]
debug = true
[log]
output="std"
level="debug"
file="test.log"
[api]
port = 8118
address = '0.0.0.0'
externurl= 'localhost'
[db]
address = 'localhost'
port = 0
[userdb]
address = 'localhost'
port = 5432
user = "warecached"
pass = "CHANGE_ME_PASSWORD"
db = "wc_test"
[mqtt]
address = 'warecache.example.com'
port = 8883
clientid = "example-server"
keepalive = 30
certpath = "./certs/client.crt"
keypath = "./certs/client.key"
rootcapath = "./certs/ca.crt"
Environment
Environment variables will overwrite configuration settings. The format for environment variables is the prefix WCD
, with each configuration group and then individual setting. The delimiter is _
.
An example variable for the api listen address is WCD_API_ADDRESS
Settings
General
Generic settings
Debug
Enables or disables debug mode.
Setting
Acceptable values
Value | Description |
---|---|
True | Enable Debug mode |
False | Disable Debug mode |
log
Settings for output logs. The output can be to a file, to stdout, or syslog.
If if the output is set to file
, then the file setting must also be configured.
Output
Setting
Acceptable values
Value | Description |
---|---|
std | Log to STDIO |
file | Log to file |
syslog | Log to syslog |
Level
Settings for log levels. Each level incoroprates the prior levels. Use this setting to filter out unwanted messages in the logs, or to debug issues.
Setting
Acceptable values
Value | Description |
---|---|
error | Enable Error messages |
warn | Enable Warning messages and above |
info | Enable Info messages and above |
debug | Enable Debug messages and above |
File
Optional setting. It is only required when using the output log of file
.
It should be a path to the file; relative or absolute.
Setting
Acceptable values
Value | Description |
---|---|
File Path | Path to file |
API
API specific settings
Address
The address that the API should listen to. This can be an IP address or FQDN.
Setting
Acceptable values
Value | Description |
---|---|
String | IP Address or FQDN |
Port
The port the API service should listen to.
Setting
Acceptable values
Value | Description |
---|---|
Integer | Port number |
External URL
The external URL that the API service should expect. This is required for CORS. The URL used here should be identical to the one that is used for creating the certificates.
Setting
Acceptable values
Value | Description |
---|---|
String | IP Address or FQDN |
DB
Item Database settings
Address
The item database address. Can be a FQDN, or ip address.
Setting
Acceptable values
Value | Description |
---|---|
String | IP Address or FQDN |
Port
The item database port.
Setting
Acceptable values
Value | Description |
---|---|
Integer | Port number |
UserDB
User Account Database settings
Address
The user database address. Can be a FQDN, or ip address.
Setting
Acceptable values
Value | Description |
---|---|
String | IP Address or FQDN |
Port
The user database port.
Setting
Acceptable values
Value | Description |
---|---|
Integer | Port number |
Username
The username to authenticate with the user database.
Setting
Acceptable values
Value | Description |
---|---|
String | Username |
Password
The password to authenticate with the user database.
Setting
Acceptable values
Value | Description |
---|---|
String | Password |
Database Name
The database name for the user database.
Setting
Acceptable values
Value | Description |
---|---|
String | Database Name |
MQTT
MQTT Connection Settings
Address
The MQTT server address. Can be a FQDN or an ip address.
Setting
Acceptable values
Value | Description |
---|---|
String | IP Address or FQDN |
Port
The MQTT server port. Should be 8883 for secured connections. All branded warecache devices support encrypted MQTT connections. Be weary of security risks without secured connections.
Setting
Acceptable values
Value | Description |
---|---|
Integer | Port number |
Client ID
The client name for the server to use when connecting to the MQTT server. It will appear in the MQTT server logs for reference.
Setting
Acceptable values
Value | Description |
---|---|
String | Client ID |
Keepalive
The required keepalive ping to the MQTT server from the client. Some MQTT servers will disconnect if the proper keepalive is not set.
Setting
Acceptable values
Value | Description |
---|---|
Integer | Keepalive in seconds |
Client Certificate
The x509 certificate that the server uses to authenticate with the MQTT server.
Setting
Acceptable values
Value | Description |
---|---|
File Path | Path to file |
Client Key
The x509 key that the server uses to authenticate with the MQTT server.
Setting
Acceptable values
Value | Description |
---|---|
File Path | Path to file |
Root Certificate Authority
The root certificate authority that signed the client certificate.
Setting
Acceptable values
Value | Description |
---|---|
File Path | Path to file |