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

3.2.x Grouped Config #12884

Merged
merged 2 commits into from Jun 17, 2017

Conversation

Projects
None yet
2 participants
@Fenikkusu

Fenikkusu commented Jun 7, 2017

Hello!

  • Type: new feature
  • Link to issue: NA

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the Contributing Guidelines?
  • I have checked that another pull request for this purpose does not exist.
  • I wrote some tests for this PR.

Small description of change:

Many systems use the concept of distribution config files where config.conf is added to the repo but config.dist.conf is ignored. These changes allow us to easily accomplish the same concept in Phalcon. Additionally, this leverages the existing Config Factory to allow us to combine either a specifc adapter or multiple different adapters.

$configFiles = [
  [
    'adapter' => 'ini', //This specifically uses the ini adapter.
    'filePath' => '/usr/www/conf.ini'
  ],
  __DIR__ . '/etc/config.json' //This will use the default adapter.
];

if (file_exists([__DIR__ . '/etc/config.dist.json']) {
    $configFiles[] = __DIR__ . '/etc/config.dist.json'; //This will use the default adapter.
}

$configFiles[] = [
  'adapter' => 'array', //This will use the traditional \Phalcon\Config object.
  'config'   => [
    'debug' => true
  ]
];

//Initialize Config using the Json adapter as the default.
$config = new \Phalcon\Config\Adapter\Grouped($configFiles, 'json');

Thanks

@sergeyklay sergeyklay added this to the unplanned milestone Jun 7, 2017

@sergeyklay sergeyklay added the Feature label Jun 7, 2017

@sergeyklay

This comment has been minimized.

Show comment
Hide comment
@sergeyklay

sergeyklay Jun 7, 2017

Member

Could you please update the CHANGELOG.md

Member

sergeyklay commented Jun 7, 2017

Could you please update the CHANGELOG.md

@Fenikkusu

This comment has been minimized.

Show comment
Hide comment
@Fenikkusu

Fenikkusu Jun 17, 2017

Changes Applied

Fenikkusu commented Jun 17, 2017

Changes Applied

@sergeyklay sergeyklay merged commit 8796898 into phalcon:3.2.x Jun 17, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@sergeyklay

This comment has been minimized.

Show comment
Hide comment
@sergeyklay

sergeyklay Jun 17, 2017

Member

Thank you

Member

sergeyklay commented Jun 17, 2017

Thank you

@Fenikkusu Fenikkusu deleted the twistersfury:3.2.x-multi-config branch Jun 22, 2017

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