Skip to content

Configuration

Notifly can be configured via a configuration file and environment variables. When using Docker it is recommended to use environment variables.

Notifly looks for configuration files in the following paths

  • ./config.yml
  • /etc/notifly/config.yml

[!note] When strings contain YAML reserved characters, they must be escaped. List of reserved characters and how to escape them.

[!note] The configuration file /etc/notifly/config.yml may contain sensitive data, such as the initial admin password. When using it, you should remove read/write permissions for users other than the file owner:

Окно терминала
$ sudo chmod go-rw /etc/notifly/config.yml
server:
keepaliveperiodseconds: 0 # 0 = use Go's default value (15s); -1 = disable keepalive; set the keepalive packet send interval. Only change this value if you know what you're doing.
listenaddr: '' # address to bind to, leave empty to bind to all addresses. Add the "unix:" prefix to create a Unix socket. Example: "unix:/tmp/notifly.sock".
port: 80 # port that the HTTP server will listen on
ssl:
enabled: false # whether HTTPS should be enabled
redirecttohttps: true # redirect to https if the site is accessed via HTTP
listenaddr: '' # address to bind to, leave empty to bind to all addresses. Add the "unix:" prefix to create a Unix socket. Example: "unix:/tmp/notifly.sock".
port: 443 # HTTPS port
certfile: # certificate file (leave empty when using letsencrypt)
certkey: # certificate key (leave empty when using letsencrypt)
letsencrypt:
enabled: false # whether a certificate should be requested from letsencrypt
accepttos: false # whether you accept letsencrypt's Terms of Service
cache: data/certs # letsencrypt cache directory
hosts: # hosts for which letsencrypt should request certificates
# - mydomain.tld
# - myotherdomain.tld
responseheaders: # response headers that are added to every response (default: none)
# X-Custom-Header: "custom value"
trustedproxies: # IP addresses or ranges of trusted proxies. Used to obtain the remote IP via the X-Forwarded-For header. (set 127.0.0.1 to trust sockets)
# - 127.0.0.1
# - 192.168.178.0/24
# - ::1
cors: # Sets CORS headers only when necessary and supports multiple allowed origins. Overrides Access-Control-* headers in the response.
alloworigins:
# - ".+.example.com"
# - "otherdomain.com"
allowmethods:
# - "GET"
# - "POST"
allowheaders:
# - "Authorization"
# - "content-type"
stream:
pingperiodseconds: 45 # WebSocket ping send interval. Only change this value if you know what you're doing.
allowedorigins: # allowed origins for WebSocket connections (own origin is always allowed, default is own origin only)
# - ".+.example.com"
# - "otherdomain.com"
database: # see below
dialect: sqlite3
connection: data/notifly.db
defaultuser: # when creating the database, notifly creates an admin user (these values are used only on first run; if you want to change the user after first run, use the WebUI)
name: admin # default admin username
pass: admin # default admin password
passstrength: 10 # bcrypt password strength (higher = better, but also slower)
uploadedimagesdir: data/images # directory to save uploaded images
pluginsdir: data/plugins # directory where plugins are located (leave empty to disable plugins)
registration: false # enable registration

You can download an example configuration like this:

Окно терминала
$ wget -O config.yml https://raw.githubusercontent.com/Notifly/master/config.example.yml

Note: the example configuration contains more than just default values.

DialectConnection
sqlite3path/to/database.db
mysqlnotifly:secret@tcp(localhost:3306)/notiflydb?charset=utf8&parseTime=True&loc=Local
postgreshost=localhost port=5432 user=notifly dbname=notiflydb password=secret

When using postgres without SSL, add sslmode=disable to the connection string. See #90.

For mysql and postgres: make sure the specified database exists and the user has sufficient permissions.

Strings in list or map environment parameters (for example NOTIFLY_SERVER_RESPONSEHEADERS and NOTIFLY_SERVER_SSL_LETSENCRYPT_HOSTS) must be escaped. List of reserved characters and how to escape them.

See the YAML configuration documentation.

Окно терминала
NOTIFLY_SERVER_PORT=80
NOTIFLY_SERVER_KEEPALIVEPERIODSECONDS=0
NOTIFLY_SERVER_LISTENADDR=
NOTIFLY_SERVER_SSL_ENABLED=false
NOTIFLY_SERVER_SSL_REDIRECTTOHTTPS=true
NOTIFLY_SERVER_SSL_LISTENADDR=
NOTIFLY_SERVER_SSL_PORT=443
NOTIFLY_SERVER_SSL_CERTFILE=
NOTIFLY_SERVER_SSL_CERTKEY=
NOTIFLY_SERVER_SSL_LETSENCRYPT_ENABLED=false
NOTIFLY_SERVER_SSL_LETSENCRYPT_ACCEPTTOS=false
NOTIFLY_SERVER_SSL_LETSENCRYPT_CACHE=certs
# NOTIFLY_SERVER_SSL_LETSENCRYPT_HOSTS=[mydomain.tld, myotherdomain.tld]
# NOTIFLY_SERVER_RESPONSEHEADERS={X-Custom-Header: "custom value", x-other: value}
# NOTIFLY_SERVER_TRUSTEDPROXIES=[127.0.0.1,192.168.178.2/24]
# NOTIFLY_SERVER_CORS_ALLOWORIGINS=[.+\.example\.com, otherdomain\.com]
# NOTIFLY_SERVER_CORS_ALLOWMETHODS=[GET, POST]
# NOTIFLY_SERVER_CORS_ALLOWHEADERS=[X-Notifly-Key, Authorization]
# NOTIFLY_SERVER_STREAM_ALLOWEDORIGINS=[.+.example\.com, otherdomain\.com]
NOTIFLY_SERVER_STREAM_PINGPERIODSECONDS=45
NOTIFLY_DATABASE_DIALECT=sqlite3
NOTIFLY_DATABASE_CONNECTION=data/notifly.db
NOTIFLY_DEFAULTUSER_NAME=admin
NOTIFLY_DEFAULTUSER_PASS=admin
NOTIFLY_PASSSTRENGTH=10
NOTIFLY_UPLOADEDIMAGESDIR=data/images
NOTIFLY_PLUGINSDIR=data/plugins
NOTIFLY_REGISTRATION=false