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

Configuration setting source precise reporting #16

Open
lalloni opened this issue Aug 10, 2012 · 2 comments
Open

Configuration setting source precise reporting #16

lalloni opened this issue Aug 10, 2012 · 2 comments
Assignees

Comments

@lalloni
Copy link
Contributor

lalloni commented Aug 10, 2012

When building an application with complex configuration read from many sources it is desirable being able to report precisely on the source location of any given setting when appropriate.

For example when reporting configuration errors it is highly desirable being able to report precisely the source of the conflicting setting to facilitate fixing the situation.

Another example is when reporting some collection of configuration settings for user checking.

I believe for input formats, the "precise source" of the setting would be a pair of location of resource and line number from where the setting effective value has been read.

@paradigmatic
Copy link
Owner

Interesting feature. The following API could do the trick:

sealed trait Source
case object NA extends Source
case class Resource( name: String, lineNumber: Int )

//in Configuration class
// returns None if the key does not exists
def getSource( key: String ): Option[Source] = ...

It should be possible to implement it, by including another map in the Configuration class storing the key->source relationship. It is also possible to retrieve the line number with the scala parsers. So it could be easy to add it to the standard formats. However, it will require a lot of work with other formats like YAML.

@ghost ghost assigned paradigmatic Aug 13, 2012
@lalloni
Copy link
Contributor Author

lalloni commented Aug 13, 2012

Sounds like a plan... If I get some spare time I might give it a shot.

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

2 participants