Skip to content

Commit

Permalink
use app.config to fetch configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
hymvp committed Jun 27, 2024
1 parent 43eac2a commit 16a8952
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions api/extensions/storage/oci_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@
from botocore.exceptions import ClientError
from extensions.storage.base_storage import BaseStorage
import boto3
import os


class OCIStorage(BaseStorage):
def __init__(self, app: Flask):
super().__init__(app)
app_config = self.app.config
self.bucket_name = os.getenv('OCI_BUCKET_NAME')
self.bucket_name = app_config.get('OCI_BUCKET_NAME')
self.client = boto3.client(
's3',
aws_secret_access_key=os.getenv('OCI_SECRET_KEY'),
aws_access_key_id=os.getenv('OCI_ACCESS_KEY'),
endpoint_url=os.getenv('OCI_ENDPOINT'),
region_name=os.getenv('OCI_REGION')
aws_secret_access_key=app_config.get('OCI_SECRET_KEY'),
aws_access_key_id=app_config.get('OCI_ACCESS_KEY'),
endpoint_url=app_config.get('OCI_ENDPOINT'),
region_name=app_config.get('OCI_REGION')
)

def save(self, filename, data):
Expand Down

1 comment on commit 16a8952

@hymvp
Copy link
Contributor Author

@hymvp hymvp commented on 16a8952 Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modify app_config method

Please sign in to comment.