How to put amazon s3 as primary store in separate config file

In the docs you put this in config.php

‘objectstore’ => array(
‘class’ => ‘OC\\Files\\ObjectStore\\S3’,
‘arguments’ => array(
‘bucket’ => ‘<my_bucket>’,
‘key’ => ‘<key>’,
‘secret’ => ‘<so_secret>’,
‘use_ssl’ => true,
‘region’ => ‘<region>,
// required for some non amazon s3 implementations
‘use_path_style’=>true
),
),

To enable primary store. However if i created another file like
aws.config.php in \var\www\html\config\

I’m a little confused as the proper format. Should it look like this?

<?php
$CONFIG = array (
  'objectstore' => array(
        'class' => 'OC\\Files\\ObjectStore\\S3',
        'arguments' => array(
                'bucket' => '',    
                'key'    => '',    
                'secret' => '',  
                'use_ssl' => true,
                'region' => 'us-west-2',
                'use_path_style'=>true,         
        ),
    ),
);

or should it omit the php and CONFIG. I’ve been playing around with different variations and I can’t seem to get it to work as a separate config

<?php
$CONFIG = [
	'objectstore' => array(
		'class' => \OC\Files\ObjectStore\S3::class,
		'arguments' => array(
			'bucket' => 'nextcloud',
			'autocreate' => true,
			'key' => 'homestead',
			'secret' => 'secretkey',
			'hostname' => 'localhost',
			'port' => 9600,
			'use_ssl' => false,
			'region' => 'us-east-1',
			// required for some non Amazon S3 implementations
			'use_path_style' => true
		),
	),
];

for aws.config.php

The part of the file name in the separate configuration file prior to .config.php does not matter. Some non-Amazon S3 compatible services, however, will require tweaking the 'use_path_style' or 'signature_v2' values. Here is an article that explains more about using S3 compatible services as primary storage for NextCloud.

Thanks everyone! I got it working with this

<?php
$CONFIG = [
  'objectstore' => array(
    'class' => 'OC\\Files\\ObjectStore\\S3',
    'arguments' => array(
            'bucket' => 'BUCKET',    
            'key'    => 'NEXTCLOUD_AWS_PUBLIC',    
            'secret' => 'NEXTCLOUD_AWS_PRIVATE',
            'autocreate' => false,
            'use_ssl' => true,
            'use_path_style'=>false,   
            'region' => 'us-west-2',      
    ),
),
];

Maybe we should update the documentation on how to create a separate config file mainly specifying an array

<?php
$CONFIG = [

];
1 Like