core icon indicating copy to clipboard operation
core copied to clipboard

Not clear how to set/get config reliably without example

Open icedwater opened this issue 1 year ago • 3 comments

Updating the trusted domains using the ownCloud Docker Compose instructions didn't seem to work - the domains were still untrusted even though the list was updated - so I tried editing the config using the provided occ command.

But there were conflicting instructions online on how to do so, so I tried a bunch of alternatives and none of them worked well.

Steps to reproduce

  1. Enter the docker container docker exec -ti owncloud_server bash
  2. Check current trusted_domains: occ config:system:get -- trusted_domains
  3. Update the trusted domains: occ config:system:set trusted domains "1.1.1.1,2.2.2.2,localhost" System config value trusted_domains => 1.1.1.1,2.2.2.2,localhost set to empty string
  4. Check updated value: occ config:system:get -- trusted_domains -- it doesn't change
  5. Leave the docker container.
  6. Check the config.php: sudo cat /path/to/owncloud/config/config.php -- array remains unchanged.

Expected behaviour

trusted_domains array should be updated with "1.1.1.1,2.2.2.2,localhost"

Actual behaviour

Previous value of trusted_domains is retained.

Server configuration

Operating system: Ubuntu 22.04

Web server: nginx? via Docker image

Database: mariadb via Docker image

PHP version: 7.4.3

ownCloud version: 10.13 (from docker-compose)

Updated from an older ownCloud or fresh install: fresh install

Where did you install ownCloud from: Docker image

Signing status (ownCloud 9.0 and above): not sure

Cannot sign in as all my domains are untrusted since I can't update the array reliably.

The content of config/config.php:

{
    "system": {
        "apps_paths": [
            {
                "path": "\/var\/www\/owncloud\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/owncloud\/custom",
                "url": "\/custom",
                "writable": true
            }
        ],
        "trusted_domains": [
            "0.0.0.0",
            "10.0.0.15",
            "10.0.1.15",
            "localhost"
        ],
        "datadirectory": "\/mnt\/data\/files",
        "dbtype": "mysql",
        "dbhost": "mariadb",
        "dbname": "owncloud",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "log_type": "owncloud",
        "supportedDatabases": [
            "sqlite",
            "mysql",
            "pgsql"
        ],
        "upgrade.disable-web": true,
        "default_language": "en",
        "overwrite.cli.url": "http:\/\/localhost:8080\/",
        "htaccess.RewriteBase": "\/",
        "logfile": "\/mnt\/data\/files\/owncloud.log",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "mysql.utf8mb4": true,
        "filelocking.enabled": true,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "redis",
            "port": "6379"
        },
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "version": "10.13.4.1",
        "dbconnectionstring": "",
        "allow_user_to_change_mail_address": "",
        "logtimezone": "UTC",
        "installed": true,
        "instanceid": "ocomsrjzdri7",
        "trusted_domains=[localhost]": "",
        "-vv": ""
    }
}

List of activated apps: apps here

Are you using external storage, if yes which one: local (mapped as a docker volume)

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox 121.0.1

Operating system: Windows 10

icedwater avatar Jan 31 '24 02:01 icedwater

@mmattel something for the docs?

DeepDiver1975 avatar Jan 31 '24 06:01 DeepDiver1975

Trusted domains are supposed to be set / configured only via OWNCLOUD_TRUSTED_DOMAINS according to:

https://doc.owncloud.com/server/10.13/admin_manual/installation/docker/

iasdeoupxe avatar Jan 31 '24 16:01 iasdeoupxe

Edit: Yes, but those didn't work for me at first, or I wouldn't have dug into the container. Let me add to the original question that the recommended docker .env approach failed when I followed the wrong instructions.

Thanks @iasdeoupxe for making me check again.

It would still be nice to furnish more examples for a provided command, though, especially since the default docker image doesn't have man pages.

icedwater avatar Feb 01 '24 03:02 icedwater

Docker is always special and defies our normal documentation. The rule of thumb might be:

If you run into the situation "I did as documented, it does not change anything" then examine the config/overwrite.config.php file inside you running docker container. There you learn the details about the environment variable that needs to be used instead.

Example:

docker exec -ti my_little_owncloud grep -i trusted_domains config/overwrite.config.php
  if (getenv('OWNCLOUD_TRUSTED_DOMAINS') != '') {
    $domain = array_map('trim', explode(',', getenv('OWNCLOUD_TRUSTED_DOMAINS')));
    'trusted_domains' => $domain,

jnweiger avatar Feb 20 '24 17:02 jnweiger