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

Add string support #38

Open
vncntd opened this issue Aug 30, 2018 · 0 comments
Open

Add string support #38

vncntd opened this issue Aug 30, 2018 · 0 comments

Comments

@vncntd
Copy link

vncntd commented Aug 30, 2018

Looking for backend currently implemented I was asking myself about the utility of a new one able to handle strings given as parameter.

For exemple if the configuration is fetched from a remote URL (that returns it as a JSON or YAML etc..) - it could be nice to be able to include the fetched result in the config.

As you already are handling Unmarshaler here : ( https://github.com/heetch/confita/blob/master/config.go#L161 )
it could, for exemple, take the following form :

loader := confita.NewLoader(
  data.NewBackend(json.NewDecoder(content)), 
)

or, if for any reason you want to keep the content :

loader := confita.NewLoader(
  data.NewBackend(content, "json"), 
)

( maybe data is not the most relevant name tbh 🙈 )

for the rest it's pretty similar with what you already are doing in the file backend (just replacing the file operations part)

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

No branches or pull requests

1 participant