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 files #6

Merged
merged 6 commits into from
Apr 24, 2015
Merged

Add files #6

merged 6 commits into from
Apr 24, 2015

Conversation

baliame
Copy link
Collaborator

@baliame baliame commented Apr 23, 2015

Adds the ability to specify a configuration file. By default, configuration files are not considered, they must be explicitly specified.

To specify a configuration file, set the FileHandler of an instance of Config to any valid object implementing the gofigure.File interface. Only configuration options whose FileSpec is specified are extracted from configuration files. A 'file spec' for a configuration option matches the regex (?P[^.]+.)*(?P). For example, a specification could be 'options.video.resolution', which would extract the 'resolution' key from the 'video' subcategory of category 'options'.

This pull request comes with an example implementation of file, JsonFile, which can be used to extract information of any type as a string from a JSON file. Each JSON object is a category, which can contain
any amount of categories (objects) or values (primitive types - string, number or boolean).

The JSON file functionality is tested.

By default, the configuration file takes precedence over the environment. This can be reversed by a flag on the Config object. Feel free to alter this, the tests do not depend on its default value.

cpliakas added a commit that referenced this pull request Apr 24, 2015
@cpliakas cpliakas merged commit 390081a into cpliakas:master Apr 24, 2015
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

Successfully merging this pull request may close these issues.

2 participants