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

support for explicit "public" settings, serialization for client?.. #71

Closed
busticated opened this issue May 11, 2015 · 2 comments
Closed

Comments

@busticated
Copy link
Contributor

hey all -

more of a question than an issue here. i'm using convict for a fairly traditional web app. i'd like to make it a bit easier to share config settings between server and client. for example, say you wanted to share validation rules / constraints - something like username max length. today, you basically serialize some subset of your configs (taking care to avoid exposing sensitive settings), output with your markup, then deserialize and use client-side. there are variations to the theme here obviously but the common bits are a) flagging certain settings as safe to send to the client and b) only exposing the safe subset of settings.

the key thing I could see convict helping w/ is the ability to flag certain settings as "public" or safe to share with the client. to this end, i'm imagining extending the existing schema options w/ something like public: true (by default all settings would be considered private / server-side only) and adding a getter to retrieve all "public" settings for easier serialization.

i'm happy to dive in and put together a PR but figured i would check here first. is this something that sounds useful and a good addition to convict? are people already handling this in a nicer way?

thanks for a helpful lib!
-matt

@madarche
Copy link
Collaborator

Hello @busticated,

I understand the scenario you are describing but I don't see it as a common usecase and thus, in my opinion, it shouldn't be implemented in node-convict. If possible this functionality should be implemented in a new module called, for example, node-convict-scoped that would be using node-convict as a dependency.

But if while implementing the new module you notice that small modifications in node-convict would ease your work, please let us know.

When I first started to use node-convict I wanted to contribute new functionalities. But then I realized that those would be of use for just my very-specific usecases. And thus I have made private modules extending node-convict. node-convict should be kept as small as possible cf. http://substack.net/node_aesthetic

Best

@busticated
Copy link
Contributor Author

cool. makes sense. thanks!

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

2 participants