mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 02:08:36 +00:00
[14.0] use IAM role for service account for S3 storage (#357)
This commit is contained in:
co-authored by
GitHub
parent
72676c2b7f
commit
88b1eee7a5
@@ -52,6 +52,7 @@ class IrAttachment(models.Model):
|
||||
host = 'https://%s' % host
|
||||
|
||||
region_name = os.environ.get('AWS_REGION')
|
||||
aws_use_irsa = os.environ.get('AWS_USE_IRSA')
|
||||
access_key = os.environ.get('AWS_ACCESS_KEY_ID')
|
||||
secret_key = os.environ.get('AWS_SECRET_ACCESS_KEY')
|
||||
bucket_name = name or os.environ.get('AWS_BUCKETNAME')
|
||||
@@ -62,6 +63,12 @@ class IrAttachment(models.Model):
|
||||
'aws_access_key_id': access_key,
|
||||
'aws_secret_access_key': secret_key,
|
||||
}
|
||||
if aws_use_irsa:
|
||||
params['aws_use_irsa'] = aws_use_irsa
|
||||
elif access_key:
|
||||
params['aws_access_key_id'] = access_key
|
||||
if secret_key:
|
||||
params['aws_secret_access_key'] = secret_key
|
||||
if host:
|
||||
params['endpoint_url'] = host
|
||||
if region_name:
|
||||
@@ -74,6 +81,8 @@ class IrAttachment(models.Model):
|
||||
'If you want to write in the %s S3 bucket, this variable '
|
||||
'must be set as well:\n'
|
||||
'* AWS_BUCKETNAME\n'
|
||||
'if you want to user IRSA authentification method set'
|
||||
'* AWS_USE_IRSA\n'
|
||||
'Optionally, the S3 host can be changed with:\n'
|
||||
'* AWS_HOST\n'
|
||||
) % (bucket_name, bucket_name)
|
||||
|
||||
Reference in New Issue
Block a user