modon
modon

Reputation: 239

Amazon S3 bucket upload

How can I change my amazon s3 bucket name depending on what development area I am on.

For example: for testing and Development I have same amazon s3 bucket. But I want to change the bucket names dynamically depending on the environment the application will be.

I have something like this now:

$this->s3->putObjectFile($thumb_config['new_image'], 'newimage',
                                         $filename, S3::ACL_PUBLIC_READ);

I want this newimage to be dynamic depending on which server the application will be.

I can make this newimage as a variable but then how I set values to this variable.

Please share your ideas, thoughts and experience with me.

Upvotes: 0

Views: 220

Answers (1)

acairns
acairns

Reputation: 505

You could use an environment configuration file: http://ellislab.com/codeigniter/user-guide/libraries/config.html#environments

You would create this file in:

./application/config/{ENVIRONMENT}/{FILENAME}.php

CodeIgniter will first try to load a configuration file from the current environment - if none is found, it will look for a global configuration file.

For example:

./application/config/production/aws.php

./application/config/development/aws.php

Locally, the development configuration will be loaded, but on a production server with the environment set to production - an alternative config can be provided.

Hope this helps.

Upvotes: 0

Related Questions