Coder Social home page Coder Social logo

Comments (10)

viktorklang avatar viktorklang commented on July 24, 2024

Would be nice with a "help" mode that checks the key inside all the fallbacks and suggests: "Did you mean xxx.yyy.key ?"?

from config.

viktorklang avatar viktorklang commented on July 24, 2024

And use something like Levenshtein distance to do fuzzy matching to detect misspellings: http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/StringUtils.html#getLevenshteinDistance(java.lang.String, java.lang.String)

from config.

havocp avatar havocp commented on July 24, 2024

It's a bit awkward that we don't really have a way to print a warning (without putting a logger dependency in the config lib). We can either throw an exception or be silent.

One option could be to have a method which returns a list of warnings for a subtree (such as the akka subtree), similar to the current checkValid but with warnings not exceptions... then Akka for example could call this method (on the akka subtree only) and log the result.

It might basically complain about any setting which doesn't either 1) override another setting from reference.conf or 2) get used from a ${} expression.

Another idea would be something like -Dconfig.verbose=1 which would print warnings to stderr but I don't like it much since people won't know to turn it on.

from config.

viktorklang avatar viktorklang commented on July 24, 2024

You could pass in a "logger" when constructing the Config through the ConfigFactory, and default to a "logger" that does nothing.

from config.

rkuhn avatar rkuhn commented on July 24, 2024

But it would still need special syntax: we do not want warnings all over the place because people define custom dispatchers. The check can only work if it is limited to settings which the end user marked as “do check”. The docs could make it clear that this should be the normal way to declare things, though.

from config.

havocp avatar havocp commented on July 24, 2024

I wonder if the special syntax should be opt-out instead of opt-in? i.e. the special syntax would mean "it's OK that this isn't used" or even "this should NOT override anything"

If we are willing to have each framework do a little work we might be able to handle things like custom dispatchers, too (I don't know exactly how, would have to work on it).

Or another option is that the "special syntax" is "use another prefix," that is, don't put your custom setting underneath akka {} ?

Just half-baked ideas from me here, it deserves some time working out details.

from config.

patriknw avatar patriknw commented on July 24, 2024

On Sep 21, 2012, at 0:15, Havoc Pennington [email protected] wrote:

I wonder if the special syntax should be opt-out instead of opt-in? i.e. the special syntax would mean "it's OK that this isn't used" or even "this should NOT override anything"

If we are willing to have each framework do a little work we might be able to handle things like custom dispatchers, too (I don't know exactly how, would have to work on it).

Or another option is that the "special syntax" is "use another prefix," that is, don't put your custom setting underneath akka {} ?

That might be a problem for akka. We are strict in defining default values, but for example the akka.actor.deployment. is more advanced than normal defaults.

Just half-baked ideas from me here, it deserves some time working out details.


Reply to this email directly or view it on GitHub.

from config.

rkuhn avatar rkuhn commented on July 24, 2024

I wonder if the special syntax should be opt-out instead of opt-in? i.e. the special syntax would mean "it's OK that this isn't used" or even "this should NOT override anything"

No, I think it is imperative that we keep the default “open”, i.e. by default you can just put anything you want anywhere in the config tree and nobody will complain (unless a consumer does not like the value’s format). As Patrik pointed out we need this flexibility, and not only for our own data but if people write their own Dispatcher implementations they’ll get the config section (complete) where they make use of it and can this way pass their own non-akka config in. Schema-less is fine!

from config.

patriknw avatar patriknw commented on July 24, 2024

On Thu, Sep 20, 2012 at 11:05 PM, Havoc Pennington <[email protected]

wrote:

It's a bit awkward that we don't really have a way to print a warning
(without putting a logger dependency in the config lib). We can either
throw an exception or be silent.

One option could be to have a method which returns a list of warnings for
a subtree (such as the akka subtree), similar to the current checkValid but
with warnings not exceptions... then Akka for example could call this
method (on the akka subtree only) and log the result.

I kind of like this suggestion instead of logging. We already use
checkValid and this would follow the same path.

It might basically complain about any setting which doesn't either 1)
override another setting from reference.conf or 2) get used from a ${}
expression.

Another idea would be something like -Dconfig.verbose=1 which would print
warnings to stderr but I don't like it much since people won't know to turn
it on.


Reply to this email directly or view it on GitHubhttps://github.com//issues/39#issuecomment-8745591.

Patrik Nordwall
Typesafe http://typesafe.com/ - The software stack for applications that
scale
Twitter: @patriknw

from config.

havocp avatar havocp commented on July 24, 2024

So to step back and define the problem, I guess the goal is:

  • try to eliminate the FAQ that people configure the wrong key and it does nothing

(this is also an SBT FAQ, incidentally...)

Some properties of a really nice solution I think would be:

  • is enabled by default / in the documented way to do it (otherwise it won't fix the FAQ right?)
  • works with all the syntax variants (JSON, HOCON, .properties, hypothetical future ones)
  • no false alarms, or at least an easy way to "silence" any false alarms
  • doesn't interfere with ability to have settings that are unknown to Akka (or unknown to whatever other code is also using the config file)

Some things I think we could compromise if they enable a nice solution:

  • require some extra code from library/framework developers
  • some "namespaces" are treated differently from others (this is already done to a small extent, with checkValid used to check "your own" namespace only)
  • warnings are somewhat heuristic (for example, it's OK if some broken situations don't trigger warnings, as long as we still reduce FAQs by warning about common problems)
  • ??? it's always helpful to make more "what could we budge" options like this when looking for solutions

So, how might we get the really nice solution... surely there's some answer. A little late at night for me right now though so I'll see if sleeping on it helps ;-)

from config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.