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

RFE: Override config.php pathname with environment variable #300

Closed
gdamjan opened this issue Jul 3, 2016 · 14 comments
Closed

RFE: Override config.php pathname with environment variable #300

gdamjan opened this issue Jul 3, 2016 · 14 comments

Comments

@gdamjan
Copy link
Contributor

gdamjan commented Jul 3, 2016

Allow to override the pathname of the config file (or config directory) so that it can be placed outside the nextcloud installed files.

This would make it easier to update the server code, and/or also to use a single code for several installations (with different configs).

ps.
if the idea is accepted, I can try make a PR too

@MariusBluem
Copy link
Member

Mhmm... Interessting. This would mean we need a 2nd config file where we set the path to the "real" config? 😁

@gdamjan
Copy link
Contributor Author

gdamjan commented Jul 3, 2016

that's part of the php hosting environment, afaik with apache you'd use SetEnv, and with uwsgi (my app-server of choice) you'd use --env (or Environment in its systemd service file).
You need a config file for those anyway.

@MorrisJobke
Copy link
Member

This would make the CLI tool also harder to execute and it makes the complexity of the system a bit bigger. Beside that I don't have anything in mind, why this would not work out.

Maybe @nickvergessen @schiessle or @LukasReschke has something in mind.

@MorrisJobke MorrisJobke added enhancement 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jul 4, 2016
@gdamjan
Copy link
Contributor Author

gdamjan commented Jul 4, 2016

yes, the CLI would have to have the same env var. I consider this an advanced setting, so the default would still be as it is now. people that have it configured would have to remember to set the same env var for the cli too.

@MariusBluem MariusBluem added 2. developing Work in progress and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jul 29, 2016
@gdamjan
Copy link
Contributor Author

gdamjan commented Jul 30, 2016

btw, there are random places in the code-base that create paths based on OC::$SERVERROOT. Going forward it might be more practical to change those to an interface through OC, i.e. functions or properties.

@kyrofa
Copy link
Member

kyrofa commented Aug 2, 2016

btw, there are random places in the code-base that create paths based on OC::$SERVERROOT. Going forward it might be more practical to change those to an interface through OC, i.e. functions or properties.

👍 I've encountered the same.

MorrisJobke added a commit that referenced this issue Aug 9, 2016
introduce NEXTCLOUD_CONFIG_DIR env variable (see #300)
@gdamjan
Copy link
Contributor Author

gdamjan commented Aug 19, 2016

this was merged in #660

@gdamjan gdamjan closed this as completed Aug 19, 2016
@MorrisJobke MorrisJobke added this to the Nextcloud 11.0 milestone Aug 19, 2016
@MorrisJobke MorrisJobke removed the 2. developing Work in progress label Aug 19, 2016
@MorrisJobke
Copy link
Member

this was merged in #660

And will be available with Nextcloud 11 🎉

@jospoortvliet
Copy link
Member

Hi guys,

It would help us a fair bit if this was backported to 10 stable - it means we don't have to apply a patch for our Snap. Then we can even do daily snaps!!! Is it feasible to backport?

nickvergessen pushed a commit that referenced this issue Aug 26, 2016
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`.
@MorrisJobke
Copy link
Member

It would help us a fair bit if this was backported to 10 stable - it means we don't have to apply a patch for our Snap. Then we can even do daily snaps!!! Is it feasible to backport?

cc @karlitschek because this is usually a feature and we only backport bug fixes 🙈

@nickvergessen
Copy link
Member

Already backported in #1081

GitHubUser4234 pushed a commit to GitHubUser4234/server that referenced this issue Aug 30, 2016
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`.
GitHubUser4234 pushed a commit to GitHubUser4234/server that referenced this issue Aug 30, 2016
introduce NEXTCLOUD_CONFIG_DIR env variable (see nextcloud#300)
@jluttine
Copy link

This is a great feature, thanks. I searched if this was supported or not for many hours and couldn't find that it was. Until finally now. Would it be possible to add something about this into the documentation? Or did I just miss any mentioning of it there..?

@nickvergessen
Copy link
Member

No, I don't think so. Can you add an issue in https://github.com/nextcloud/documentation/issues/new
Thanks

@jluttine
Copy link

@nickvergessen Done.

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

No branches or pull requests

7 participants