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

Strict configuration mode #763

Open
xsawyerx opened this issue Nov 13, 2014 · 9 comments
Open

Strict configuration mode #763

xsawyerx opened this issue Nov 13, 2014 · 9 comments

Comments

@xsawyerx
Copy link
Member

Dancer 1 has a strict configuration mode that makes sure you don't hit configuration keys that don't have values (because you might have misspelled the key).

@Ovid requested we add it to Dancer2 as well.

@DavsX
Copy link

DavsX commented Nov 18, 2014

So basically before setting a value this way we should check if it exists first? What about nested stuff, like template engine etc? How deep would it be 'strict'?

Or does this mean that retreiving a configuration key which is not set would cause an error or something?

@xsawyerx
Copy link
Member Author

@Ovid, care to answer per your vision? :)

@DavsX
Copy link

DavsX commented Nov 29, 2014

This is it? https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Config.pod#strict_config-boolean-default:-false

If so should we aim for transparency? I.e. should we allow $config->{value} for strict and non-strict mode as well? Or should strict mode be used like $config->value?

@Ovid
Copy link

Ovid commented Nov 29, 2014

In theory that's it, but as far as I can tell, the feature is documented by not implemented. See also:

https://github.com/PerlDancer/Dancer2/search?utf8=%E2%9C%93&q=strict_config

@xsawyerx
Copy link
Member Author

xsawyerx commented Feb 6, 2015

What the hell...?

@xsawyerx
Copy link
Member Author

xsawyerx commented Feb 6, 2015

I'm just now realizing we still have stuff in the Config document that don't exist in D2.

@xsawyerx xsawyerx removed the Core label Sep 19, 2015
@cromedome
Copy link
Contributor

Having been bit by my own typos twice in the last two days, I am suddenly feeling the urge to work on this... keep you all posted.

@cromedome
Copy link
Contributor

@DavsX - someone can correct me if I am wrong here, but I think objects in Moo are just blessed references to hashes. I don't think we prevent someone from accessing the internals of the config object if we try.

All the same, I think if strict mode is enabled, the encouraged behavior needs to be config->setting.

Spending some time this morning abusing Moo and seeing how to accomplish this.

@mikkoi
Copy link

mikkoi commented Feb 5, 2017

@DavsX - Any progress on this issue?

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

No branches or pull requests

5 participants