-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
introduce NEXTCLOUD_CONFIG_DIR env variable (see #300) #660
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
Conversation
|
ps, the only thing I was not sure about is autoconfig.php in SetupController.php. Do I have access to configDir here? or I should repeat the logic about NEXTCLOUD_CONFIG_DIR? |
|
ps. I'm struglling a bit with getConfig in Server.php - brb |
nextcloud by default uses the `/config/` directory in the source/application tree for its config file(s). with this commit that directory can be overridden by the `NEXTCLOUD_CONFIG_DIR` environment variable. in uwsgi, you would use the option `--env "NEXTCLOUD_CONFIG_DIR=/tmp/nx-config/"` in apache `SetENV …` and the cli command can be run with: `NEXTCLOUD_CONFIG_DIR=/tmp/nx-config ./occ` (or just use `export` once in the shell). NEXTCLOUD_CONFIG_DIR can be supplied with or without the trailing slash (`/`), but in all cases `$configDir` will have it automatically added if needed. The other changes are several occurrences of `OC::$SERVERROOT . '/config'` to `OC::$configDir`.
|
@gdamjan Thanks a lot for your pull request. Can you explain the use case of it? Thanks! |
|
well, I've talked about it here #300 but the main issue is, I want to avoid the config file to be part of the nextcloud directory, since that directory is controlled by the package manager (and can be on a read-only filesystem etc). |
|
@gdamjan thanks for providing the reference |
|
I think this makes sense. @LukasReschke are there any implications security wise? I can't see some, but just want to double check (especially regarding the ENV variable injection stuff that HTTPoxy did). |
|
The environment variable injection would only inject variables starting with HTTP_. It was unfortunate that libraries/programs also used http_proxy :/ But in this case it can't be done. |
|
Looks good 👍 |
|
@gdamjan There seems to be another occurrence in the setup controller. Could you also fix that? See https://github.com/nextcloud/server/pull/697/files |
|
@MorrisJobke yes, I asked about that one several comments before. should I modify it to use \OC::$configDir too? |
Makes sense. Thanks 😃 |
|
Great PR @gdamjan, thank you 👍 |
|
Just one question about the rumoured performance hit of doing it this way. Just a rumour? |
|
the environment is stored in the process memory, getenv is not even a sys-call. just a search through a small table of variables. compared to everything nextcloud does, even what PHP does, I think it's less than negligible. |
Yes. Performance wise this isn't really an issue. |
|
I tested this and it works 👍 |
|
@gdamjan Thanks a lot for your contribution :) Feel free to join our IRC channel #nextcloud-dev on freenode :) |
|
thanks all |
introduce NEXTCLOUD_CONFIG_DIR env variable (see nextcloud#300)
…ions/actions/setup-python-6.0.0 chore(deps): Bump actions/setup-python from 5.6.0 to 6.0.0
nextcloud by default uses the
/config/directory in the source/application tree for its config file(s). with this commit that directory can be overridden by theNEXTCLOUD_CONFIG_DIRenvironment variable.in uwsgi, you would use the option
--env "NEXTCLOUD_CONFIG_DIR=/tmp/nx-config/"in apache use
SetENV …and the cli command can be run with:
NEXTCLOUD_CONFIG_DIR=/tmp/nx-config ./occ(or just useexportonce in the shell).NEXTCLOUD_CONFIG_DIR can be supplied with or without the trailing slash (
/), but in all cases$configDirwill have it automatically added if needed.The other changes are several occurrences of
OC::$SERVERROOT . '/config'toOC::$configDir.