Autoconfig vs occ 'maintenance:install'

There seems to be some partial overlap in functionality. In particular, I can’t set a few values via maintenance:install that I can set via autoconfig, e.g.

  • trusted_domains
  • adminlogin
  • adminpass
  • smtp settings

What is the recommended way for scriped installs these days?

adminlogin can be set via --admin-user <username>
adminpass can be set via --admin-pass <password>

trusted_domains needs to be set via a new call. First list all existing domains:

$ occ config:system:get trusted_domains
[
    "localhost",
    "nextcloud11.local"
]

To add a new one you can run the following command: occ config:system:set trusted_domains <number of existing entries> --type string --value="192.168.178.42"

SMTP mostly works the same:

occ config:system:set mail_smtpmode --type string --value="smtp"
occ config:system:set mail_smtpsecure --type string --value="tls"
....

See https://github.com/nextcloud/server/blob/1614b310ef0e4871dc5f21630e887010e0fb22bc/config/config.sample.php#L245 for a list of variables