{"action":"created","issue":{"url":"https://api.github.com/repos/modxcms/revolution/issues/13834","repository_url":"https://api.github.com/repos/modxcms/revolution","labels_url":"https://api.github.com/repos/modxcms/revolution/issues/13834/labels{/name}","comments_url":"https://api.github.com/repos/modxcms/revolution/issues/13834/comments","events_url":"https://api.github.com/repos/modxcms/revolution/issues/13834/events","html_url":"https://github.com/modxcms/revolution/pull/13834","id":308285102,"number":13834,"title":"[WIP/PoC] YAML config file","user":{"login":"OptimusCrime","id":2326278,"avatar_url":"https://avatars0.githubusercontent.com/u/2326278?v=4","gravatar_id":"","url":"https://api.github.com/users/OptimusCrime","html_url":"https://github.com/OptimusCrime","followers_url":"https://api.github.com/users/OptimusCrime/followers","following_url":"https://api.github.com/users/OptimusCrime/following{/other_user}","gists_url":"https://api.github.com/users/OptimusCrime/gists{/gist_id}","starred_url":"https://api.github.com/users/OptimusCrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OptimusCrime/subscriptions","organizations_url":"https://api.github.com/users/OptimusCrime/orgs","repos_url":"https://api.github.com/users/OptimusCrime/repos","events_url":"https://api.github.com/users/OptimusCrime/events{/privacy}","received_events_url":"https://api.github.com/users/OptimusCrime/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-24T18:04:24Z","updated_at":"2018-03-26T09:25:56Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/modxcms/revolution/pulls/13834","html_url":"https://github.com/modxcms/revolution/pull/13834","diff_url":"https://github.com/modxcms/revolution/pull/13834.diff","patch_url":"https://github.com/modxcms/revolution/pull/13834.patch"},"body":"### What does it do?\r\nThis work-in-progress Proof of Concept uses a YAML config file, instead of the regular _config.inc.php_ file. \r\n\r\nWe use the _symphony/yaml_ library for parsing the file. Note that the file type is `.yaml.php`. This was ment to make the file unreadable from the internet, but I realize now that that will not work because we have no opening `<?php`  tag in the file. Not sure how to handle this.\r\n\r\nAn example of a working config file looks like this:\r\n\r\n```\r\nmodx:\r\n  db:\r\n    type: mysql\r\n    server: db\r\n    user: revolution\r\n    password: revolution\r\n    connection_charset: utf8\r\n    database: revolution\r\n    table_prefix: modx_\r\n    dns: mysql:host=db;dbname=revolution;charset=utf8\r\n    config_options:\r\n    driver_options:\r\n  last_install_time: 1511612195\r\n  id: modx5a195f23229026.07399157\r\n  https_port: 443\r\n  uuid: 55e54c57-9018-44cd-ba9a-5bfcc0b3bec0\r\n  url_scheme: automatic\r\n  http_host: 192.168.99.100:8000\r\n  disable_cache: false\r\n  paths:\r\n    base: /var/www/html/\r\n    core: /var/www/html/core/\r\n    processors: /var/www/html/core/model/modx/processors/\r\n    connectors: /var/www/html/connectors/\r\n    manager: /var/www/html/manager/\r\n    assets: /var/www/html/assets/\r\n  urls:\r\n    base: /\r\n    connectors: /connectors/\r\n    manager: /manager/\r\n    assets: /assets/\r\n  log_levels:\r\n    fatal: 0\r\n    error: 1\r\n    warn: 2\r\n    info: 3\r\n    debug: 4\r\n```\r\n\r\nNote that there is still a lot work that needs to be done on this (installation, upgrade, migration from 2.x etc). I am also considering moving the YAML logic out of the MODX class to avoid bloating it even more.\r\n\r\nThis PR works if you install the composer depdency and place the config content above in the file `core/config/config.yaml.php` (on traditional installations).\r\n\r\nAlso note that this PoC is backwards compatible with the old `config.inc.php` type config files.\r\n\r\n### Why is it needed?\r\nThe benefit of using a YAML config file is that we can avoid some global variables that can cause problems with other systems (we experienced this with phpBB). YAML files are also more readable and easier to edit. This leads to less chance of bugs or problems. We can also mitigate away from having logic in the config files. This should be placed in the actual MODX code, not resolved in the config itself. There is still some work left to do here. The plan is to slim the config down, meaning remove redundant settings."},"comment":{"url":"https://api.github.com/repos/modxcms/revolution/issues/comments/376102784","html_url":"https://github.com/modxcms/revolution/pull/13834#issuecomment-376102784","issue_url":"https://api.github.com/repos/modxcms/revolution/issues/13834","id":376102784,"user":{"login":"garryn","id":233388,"avatar_url":"https://avatars1.githubusercontent.com/u/233388?v=4","gravatar_id":"","url":"https://api.github.com/users/garryn","html_url":"https://github.com/garryn","followers_url":"https://api.github.com/users/garryn/followers","following_url":"https://api.github.com/users/garryn/following{/other_user}","gists_url":"https://api.github.com/users/garryn/gists{/gist_id}","starred_url":"https://api.github.com/users/garryn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garryn/subscriptions","organizations_url":"https://api.github.com/users/garryn/orgs","repos_url":"https://api.github.com/users/garryn/repos","events_url":"https://api.github.com/users/garryn/events{/privacy}","received_events_url":"https://api.github.com/users/garryn/received_events","type":"User","site_admin":false},"created_at":"2018-03-26T09:25:56Z","updated_at":"2018-03-26T09:25:56Z","author_association":"OWNER","body":"I'm not against YAML but I know of a few use cases where this could fail (based on 2.x usage) that could cause issues (specifically around config_options) ... I'd like to see how they could be addressed in this scenario."}}
{"actor":{"display_login":"garryn"}}