miniflux / v2

Minimalist and opinionated feed reader
https://miniflux.app
Apache License 2.0
6.74k stars 714 forks source link

`-config-dump` prints incorrect values for some keys #2558

Open xfzv opened 6 months ago

xfzv commented 6 months ago
% miniflux -i
Version: 2.1.1
Commit: 382885f
Build Date: 2024-03-10T17:53:43+0000
Go Version: go1.22.0
Compiler: gc
Arch: amd64
OS: linux
% cat "/etc/miniflux.conf"
RUN_MIGRATIONS=1
DATABASE_URL="user=postgres password=postgres dbname=miniflux2 sslmode=disable"
CLEANUP_ARCHIVE_READ_DAYS=30
FETCH_ODYSEE_WATCH_TIME=1
FETCH_YOUTUBE_WATCH_TIME=1

"Global configuration options" section in "Settings > About" displays correct settings. However, I noticed that % miniflux -config-dump seems to print default values instead of those set in /etc/miniflux.conf.

A diff between what is displayed in "Global configuration options" and what % miniflux -config-dump prints.

+ CLEANUP_ARCHIVE_READ_DAYS=30
- CLEANUP_ARCHIVE_READ_DAYS=60

+ FETCH_ODYSEE_WATCH_TIME=true
- FETCH_ODYSEE_WATCH_TIME=false

+ FETCH_YOUTUBE_WATCH_TIME=true
- FETCH_YOUTUBE_WATCH_TIME=false

+ RUN_MIGRATIONS=true
- RUN_MIGRATIONS=false

Am I missing something?

xfzv commented 6 months ago

Turns out

% miniflux -config-dump -c "/etc/miniflux.conf"

prints the correct values.

Maybe this is the expected behavior? i.e -config-dump prints default values and adding -c, --config-file /path/to/miniflux.conf prints values from miniflux.conf

From the man page:

OPTIONS
       -config-dump
           Print parsed configuration values. This will include sensitive information like passwords.

To me, -config-dump should print whatever is in /etc/miniflux.conf without having to add -c, --config-file /path/to/miniflux.conf (due to the sensitive information warning).

fguillot commented 6 months ago

This is the intended behavior. By default, Miniflux parses only environment variables. The configuration file is optional and need to be specified explicitly.

The official Docker image, and the RPM/Debian packages uses only environment variables by default.

I would be happy to improve the docs if it's not clear.

xfzv commented 6 months ago

Thank you for the details!

I'm using Miniflux on Gentoo / Arch Linux so I went with miniflux systemd service + /etc/miniflux.conf. That's why I thought the values were not parsed correctly.

privatmamtora commented 2 months ago

@fguillot yes, the docs do need an update. I was following the Debian doc, and currently the "Configure Miniflux" steps are wrong.

Step #2 & #3 end up using the default DATABASE_URL value, not the variable set in Step #1.

Steps #2 & #3 needs to be updated to miniflux -migrate -config-file /etc/miniflux.conf and miniflux -create-admin -config-file /etc/miniflux.conf respectively.

Maybe there could be a separate "configure service" and "configure user" section.