-
Notifications
You must be signed in to change notification settings - Fork 296
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
Introduce a configuration manager #570
Conversation
Yes it does. We'll keep everything in a single file. I've added plugin update in the todo list. |
An other point to check: prevent the JSON configuration file from being accessed from a browser. This will require users to update their server / virtualhost configuration, or to store the JSON data in a serialized PHP script. |
The access should be denied for the whole |
htaccess is Apache-specific; we need to handle other setups as well (nginx, lighthttpd) and provide a sane default configuration in the docs (the lighthttpd section is empty btw, I'll see if I can fix this) |
And what about store de json between php tags? |
@virtualtam There is no htaccess equivalent for nginx, but we have a pretty good documentation on it (thanks to you I believe). I never used another webserver. @nicolasdanelon Yep that's what we meant. |
Oh great! Good luck then ^^ |
cca9ba1
to
c64005e
Compare
c64005e
to
6a080b4
Compare
It's starting to look good. Please review and test it, since I might have missed a few things in all of this. I've renamed configuration keys to be a bit more coherent. The documentation is here. It will be added in the wiki when this PR is merged. Also note that the automatic transition PHP -> JSON code is a bit messy (especially in unit tests). It might be a good idea to drop it when we'll reach 1.0.0. |
Does it migrate current user settings to the new format? Or does the user have to reconfigure/reinstall? Great work! |
Everything is automagic, and the PHP conf file is backed up. |
Neat! I'm starting the review ;-) |
$this->setEmpty('path.page_cache', 'pagecache'); | ||
|
||
$this->setEmpty('security.ban_after', 4); | ||
$this->setEmpty('security.ban_after', 1800); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ban_after is reset twice
7f444f1
to
39fb209
Compare
Also use the Updater to make the transition
Except for those which require external data (timezone and $_SERVER).
39fb209
to
894a3c4
Compare
+1, this way we can flag |
"plugins": { | ||
"WALLABAG_VERSION": 1 | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing comment closing tag */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it useless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, yet generating valid files would do no harm ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this also mean adding it to ConfigJson
reading and writing methods, and editing unit tests. I can do it, but for something useless, is it worth it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users are expected to read and edit these configuration files, so it could be worth it. I'm OK with keeping the matter for a future issue/PR, though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I'll do it in this PR.
@kalvn I've added the configuration manager to templates variables. If you have in $GLOBALS['config']['foo'] = 'bar'; You can display it in the templates with:
When the updater will run, you'll end up with "config": {
"foo": "bar"
} Note that this won't work with settings outside of |
OK for me, ping @nodiscc ;-) |
Let's go! |
Nice work! I noticed a typo in And therefore, the variable I keep migrating my theme and will let you know if I find something else :) |
Thanks for the feedback, I'll fix that! |
This introduces a configuration manager which let us read and write settings anywhere properly:
It will allow us to get rid of the
$GLOBALS
configuration system, which is a very bad practice. We'll switch to JSON according to #489.This PR doesn't contain JSON conf yet, but proxy the PHP conf file behind
ConfigManagement
, for transition.Done:
config.php
index.php
.closes #471 closes #464