diff --git a/README.md b/README.md index 5989a68..70635f4 100644 --- a/README.md +++ b/README.md @@ -198,17 +198,17 @@ libreddit Assign a default value for each setting by passing environment variables to Libreddit in the format `LIBREDDIT_DEFAULT_{X}`. Replace `{X}` with the setting name (see list below) in capital letters. -| Name | Possible values | Default value | -|-----------------------|----------------------------------------------------------------------------------------|---------------| -| theme | ["system", "light", "dark", "black", "dracula", "nord", "laserwave", "violet", "gold"] | system | -| front_page | ["default", "popular", "all"] | default | -| layout | ["card", "clean", "compact"] | card | -| wide | ["on", "off"] | off | -| comment_sort | ["hot", "new", "top", "rising", "controversial"] | hot | -| post_sort | ["confidence", "top", "new", "controversial", "old"] | confidence | -| show_nsfw | ["on", "off"] | off | -| use_hls | ["on", "off"] | off | -| hide_hls_notification | ["on", "off"] | off | +| Name | Possible values | Default value | +|-------------------------|------------------------------------------------------------------------------------------|---------------| +| `THEME` | `["system", "light", "dark", "black", "dracula", "nord", "laserwave", "violet", "gold"]` | `system` | +| `FRONT_PAGE` | `["default", "popular", "all"]` | `default` | +| `LAYOUT` | `["card", "clean", "compact"]` | `card` | +| `WIDE` | `["on", "off"]` | `off` | +| `COMMENT_SORT` | `["hot", "new", "top", "rising", "controversial"]` | `hot` | +| `POST_SORT` | `["confidence", "top", "new", "controversial", "old"]` | `confidence` | +| `SHOW_NSFW` | `["on", "off"]` | `off` | +| `USE_HLS` | `["on", "off"]` | `off` | +| `HIDE_HLS_NOTIFICATION` | `["on", "off"]` | `off` | ### Examples @@ -228,6 +228,25 @@ proxy_http_version 1.1; ``` to your NGINX configuration file above your `proxy_pass` line. +## SystemD + +You can use the SystemD service available in `contrib/libreddit.service` +(install it on `/etc/systemd/system/libreddit.service`). + +That service can be optionally configured in terms of environment variables by +creating a file in `/etc/libreddit.conf`. Use the `contrib/libreddit.conf` as a +template. You can also add the `LIBREDDIT_DEFAULT__{X}` settings explained +above. + +When "Proxying using NGINX" where the proxy is on the same machine, you should +guarantee nginx waits for this service to start. Edit +`/etc/systemd/system/libreddit.service.d/reverse-proxy.conf`: + +```conf +[Unit] +Before=nginx.service +``` + ## Building ``` diff --git a/contrib/libreddit.conf b/contrib/libreddit.conf new file mode 100644 index 0000000..18b8193 --- /dev/null +++ b/contrib/libreddit.conf @@ -0,0 +1,2 @@ +ADDRESS=localhost +PORT=12345 diff --git a/contrib/libreddit.service b/contrib/libreddit.service new file mode 100644 index 0000000..b6e6fef --- /dev/null +++ b/contrib/libreddit.service @@ -0,0 +1,15 @@ +[Unit] +Description=libreddit daemon +After=network.service + +[Service] +DynamicUser=yes +# Default Values +Environment=ADDRESS=0.0.0.0 +Environment=PORT=8080 +# Optional Override +EnvironmentFile=-/etc/libreddit.conf +ExecStart=/usr/bin/libreddit -a ${ADDRESS} -p ${PORT} + +[Install] +WantedBy=default.target