caddy-s3-proxy icon indicating copy to clipboard operation
caddy-s3-proxy copied to clipboard

Settings credentials in config instead of relying on environment

Open bpolaszek opened this issue 2 years ago • 0 comments

Hey there, thanks for this great plugin!

Would it be hard to allow credentials to be passed as options, i.e.

s3proxy [<matcher>] {
    bucket <bucket_name>
    endpoint <endpoint>
    access_key_id <access_key_id>
    secret_access_key <secret_access_key>
}

This would allow connecting to several S3 Providers (just had a use case with Scaleway & DigitalOcean) on a single host.

example1.org {
  @cdn path_regexp cdn /cdn/(.*)
  route @cdn {
    rewrite @cdn {re.cdn.1}
    s3proxy {
      bucket {$EXAMPLE1_S3_BUCKET}
      endpoint {$EXAMPLE1_S3_ENDPOINT}
      access_key_id {$EXAMPLE1_S3_ACCESS_KEY_ID}
      secret_access_key {$EXAMPLE1_S3_SECRET_ACCESS_KEY}
    }
  }
}


example2.org {
  @cdn path_regexp cdn /cdn/(.*)
  route @cdn {
    rewrite @cdn {re.cdn.1}
    s3proxy {
      bucket {$EXAMPLE2_S3_BUCKET}
      endpoint {$EXAMPLE2_S3_ENDPOINT}
      access_key_id {$EXAMPLE2_S3_ACCESS_KEY_ID}
      secret_access_key {$EXAMPLE2_S3_SECRET_ACCESS_KEY}
    }
  }
}

No providing them would fall back to AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY, ~/.aws/credentials etc.

Second benefit of this is that you know that they have to exist somewhere, instead of copy/pasting config from one server to another and wasting time figuring out where to write the credentials for the plugin to work 😅 things would just become more obvious.

Thanks! Ben

bpolaszek avatar May 12 '23 15:05 bpolaszek