Where to put AWS creds for cfs:s3


#1

Where do I put my AWS credentials for cfs:s3? The docs are a little foggy about this, is it like others where they go in environmental variables on the server?


#2

According to this page, it looks like if you don’t want to use environment variables, you can also set the keys in server-side code:

var avatarStoreLarge = new FS.Store.S3("avatarsLarge", {
  accessKeyId: "ID-HERE", 
  secretAccessKey: "ACCESS-KEY-HERE", 
  bucket: "avatars.large",
  transformWrite: function(fileObj, readStream, writeStream) {
    gm(readStream, fileObj.name()).resize('250', '250').stream().pipe(writeStream)
  }
});

#3

I’ll give it a shot. Thanks for the response


#4

If you do set them like that I would recommend not hard-coding them. I’d use a settings JSON file. Then you can set it to different values for each environment (local dev, staging, production). Also you can add that file to .gitignore and not commit it to the repo which allows you to not share it with everyone who has repo access.