Configuration
Notifly can be configured via a configuration file and environment variables. When using Docker it is recommended to use environment variables.
Configuration file
Section titled “Configuration file”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.ymlmay 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.ymlserver: 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.dbdefaultuser: # 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 passwordpassstrength: 10 # bcrypt password strength (higher = better, but also slower)uploadedimagesdir: data/images # directory to save uploaded imagespluginsdir: data/plugins # directory where plugins are located (leave empty to disable plugins)registration: false # enable registrationYou can download an example configuration like this:
$ wget -O config.yml https://raw.githubusercontent.com/Notifly/master/config.example.ymlNote: the example configuration contains more than just default values.
Database
Section titled “Database”| Dialect | Connection |
|---|---|
| sqlite3 | path/to/database.db |
| mysql | notifly:secret@tcp(localhost:3306)/notiflydb?charset=utf8&parseTime=True&loc=Local |
| postgres | host=localhost port=5432 user=notifly dbname=notiflydb password=secret |
When using postgres without SSL, add sslmode=disable to the connection string.
See #90.
For
mysqlandpostgres: make sure the specified database exists and the user has sufficient permissions.
Environment variables
Section titled “Environment variables”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=80NOTIFLY_SERVER_KEEPALIVEPERIODSECONDS=0NOTIFLY_SERVER_LISTENADDR=NOTIFLY_SERVER_SSL_ENABLED=falseNOTIFLY_SERVER_SSL_REDIRECTTOHTTPS=trueNOTIFLY_SERVER_SSL_LISTENADDR=NOTIFLY_SERVER_SSL_PORT=443NOTIFLY_SERVER_SSL_CERTFILE=NOTIFLY_SERVER_SSL_CERTKEY=NOTIFLY_SERVER_SSL_LETSENCRYPT_ENABLED=falseNOTIFLY_SERVER_SSL_LETSENCRYPT_ACCEPTTOS=falseNOTIFLY_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=45NOTIFLY_DATABASE_DIALECT=sqlite3NOTIFLY_DATABASE_CONNECTION=data/notifly.dbNOTIFLY_DEFAULTUSER_NAME=adminNOTIFLY_DEFAULTUSER_PASS=adminNOTIFLY_PASSSTRENGTH=10NOTIFLY_UPLOADEDIMAGESDIR=data/imagesNOTIFLY_PLUGINSDIR=data/pluginsNOTIFLY_REGISTRATION=false