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

[stable10] Allow the config dir to be specified via the enviroment #1081

Merged
merged 2 commits into from
Aug 26, 2016

Conversation

nickvergessen
Copy link
Member

Backport of #660 to make @jospoortvliet happy.

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`.
@nickvergessen nickvergessen added this to the Nextcloud 10.0.1 milestone Aug 26, 2016
@nickvergessen
Copy link
Member Author

@gdamjan @kyrofa feel free to review this.

@karlitschek for backport approval (requested by the snappy guys so they dont have to patch it after each update again)

@karlitschek
Copy link
Member

nice feature. please backport

@gdamjan
Copy link
Contributor

gdamjan commented Aug 26, 2016

looks good to me
LGTM

@LukasReschke
Copy link
Member

LGTM

@LukasReschke LukasReschke merged commit 977c49a into stable10 Aug 26, 2016
@LukasReschke LukasReschke deleted the backport-660-config-path-from-env branch August 26, 2016 12:56
@jospoortvliet
Copy link
Member

Thanks all! Love and hugs ;-)

@Mehlstaub
Copy link

Having a problem with this. If there is no config.php in webroot/config/ folder the occ commands seem to be broken.

I've tried to put the config.php only in /etc/nextcloud

System itself works fine but occ commands return these errors

sudo -u www-data php occ maintenance:mode --on
Nextcloud is not installed - only a limited number of commands are available


  [Symfony\Component\Console\Exception\CommandNotFoundException]
  Command "maintenance:mode" is not defined.
  Did you mean this?
      maintenance:install

@gdamjan
Copy link
Contributor

gdamjan commented Oct 1, 2016

if you use this feature for the server, you need to define the envrinment variable in your shell too, before calling occ.

one example , with sudo is:
sudo -u www-data NEXTCLOUD_CONFIG_DIR=/etc/nextcloud php occ maintenance:mode --on

@Mehlstaub
Copy link

@gdamjan thanks i missed that, works now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants