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 YAML Config Files #27

Merged
merged 7 commits into from
Apr 19, 2017
Merged

Add YAML Config Files #27

merged 7 commits into from
Apr 19, 2017

Conversation

jonathangreen
Copy link
Contributor

@jonathangreen jonathangreen commented Apr 17, 2017

GitHub Issue

Part of:
Islandora/documentation#603

Related to:
Islandora/Crayfish-Commons#8

What does this Pull Request do?

Updates all the micro services to use YAML configuration files, instead of the PHP ones we were using before.

How should this be tested?

Interested parties

@Islandora-CLAW/committers

@codecov
Copy link

codecov bot commented Apr 17, 2017

Codecov Report

Merging #27 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #27   +/-   ##
=========================================
  Coverage     98.41%   98.41%           
  Complexity       35       35           
=========================================
  Files             3        3           
  Lines           126      126           
=========================================
  Hits            124      124           
  Misses            2        2

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be30482...840bfda. Read the comment docs.

@whikloj
Copy link
Member

whikloj commented Apr 18, 2017

@jonathangreen could you move Gemini/cfg/config.yaml to Gemini/cfg/config.yaml.example or something so we don't overwrite a person's actual configuration. Saves having to run git stash save and git stash pop between tests.

@jonathangreen
Copy link
Contributor Author

@whikloj moved.

Copy link
Member

@whikloj whikloj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues with the Crayfish-Commons PR I have raised there. But I had one problem getting to the config file here.


$app['gemini.controller'] = function () use ($app) {
$app->register(new IslandoraServiceProvider());
$app->register(new YamlConfigServiceProvider('../cfg/config.yaml'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble with this line, not sure if its because I have my code shared into the vagrant box, but I needed to make it
$app->register(new YamlConfigServiceProvider(__DIR__ . '/../cfg/config.yaml'));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is minor and I think I mentioned it to @dannylamb on a previous PR. But should we do a sanity check for the existence of this file and if it is not there, throw a simple clean message. Currently you just get an ugly stack trace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is fairly hard to give a simple clean error with no logging bootstrapped at this point. Do you have any suggestions for how to accomplish what you would like?


$app['houdini.controller'] = function ($app) use ($config) {
$app->register(new IslandoraServiceProvider());
$app->register(new YamlConfigServiceProvider('../cfg/config.yaml'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment regarding needing __DIR__

$app = new Application();
$app->register(new IslandoraServiceProvider($config));
$app->register(new IslandoraServiceProvider());
$app->register(new YamlConfigServiceProvider('../cfg/config.yaml'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last time, see above comment regarding need for __DIR__

@jonathangreen
Copy link
Contributor Author

Updated the directory where we load the configuration from as suggested.

@acoburn
Copy link
Contributor

acoburn commented Apr 18, 2017

I don't have any issues with the code here per se, but I am concerned about the design. My intention with the original issue was twofold: first, make the configuration YAML-based (rather than based on a PHP array) -- that is clearly solved here; and second, to use the existing Symfony facilities for handling configuration -- that is (from what I can tell) not the case.

There are many advantages of using the Symfony infrastructure for this -- first, you can define a schema for the configuration, so structural errors are clearly caught, and secondly, you can define default values. This means that a user needs only to define the required elements, and the rest can default to sensible values. Why is that important? Imagine a user has Crayfish version 1.2.3 installed with a given configuration, but then updates to version 1.2.4. If that version introduces an optional configuration value, there would need to be no change to the user's config; but as I am reading the code here, it seems that, given this structure, the new version would throw an error. That is exactly what I was trying to avoid when I opened this issue.

@jonathangreen
Copy link
Contributor Author

@acoburn there is more discussion on the other pull request. See my response there.

@whikloj
Copy link
Member

whikloj commented Apr 19, 2017

@jonathangreen needs a rebase.

@whikloj whikloj merged commit 7b13dbd into Islandora:master Apr 19, 2017
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.

3 participants