Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initialization of conf for stats #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

balki
Copy link

@balki balki commented May 10, 2023

Problem

Even though I set statistics_password in my config (which is /etc/speedtest-settings.toml), I got the message 'Please set statistics_password in settings.toml to enable access'.

Root cause

In stats.go, global var conf is initialized even before main is called. At this time configFile is empty as it is not set yet. If the config path is not explicitly set using -c flag, viper initializes from settings.toml in current folder. If no settings.toml files is found, conf is initialized with default values and thus does not use the password set in config file.

@balki
Copy link
Author

balki commented May 11, 2023

Unintentionally pushed a different change to same branch. Let me know if need to recreate PR with just the original change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant