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

Misleading documentation for Watchable Providers #171

Closed
stv0g opened this issue Sep 18, 2022 · 3 comments
Closed

Misleading documentation for Watchable Providers #171

stv0g opened this issue Sep 18, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@stv0g
Copy link

stv0g commented Sep 18, 2022

The documentation current says:

The koanf.Provider interface has a Watch(cb) method that asks a provider to watch for changes and trigger the given callback that can live reload the configuration.

which is not true:

https://pkg.go.dev/github.com/knadh/koanf#Provider

I think the paragraph should be changed to something along the lines:

Some koanf.Provider implementations provide a Watch(cb) method that asks a provider to watch for changes and trigger the given callback that can live reload the configuration.

@stv0g stv0g added the bug Something isn't working label Sep 18, 2022
@stv0g
Copy link
Author

stv0g commented Sep 18, 2022

I also realized that the env provider implements Watch() while not even supporting it.

I would say that it be nice to have a koanf.WatchableProvider interface which is only implemented by those providers which support it so that we can simply test for it rather than handling the error.

@knadh knadh closed this as completed in 3e03354 Sep 19, 2022
@knadh knadh added documentation Improvements or additions to documentation and removed bug Something isn't working labels Sep 19, 2022
@knadh
Copy link
Owner

knadh commented Sep 19, 2022

Ah yes. Watch() must've been a part of the Provider interface at some point, which is why there are Watch() stubs that return errors across providers. Cleaned this.

@stv0g
Copy link
Author

stv0g commented Sep 19, 2022

Thanks! This looks much cleaner

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

No branches or pull requests

2 participants