Skip to content

Commit

Permalink
fix: dbname env get
Browse files Browse the repository at this point in the history
  • Loading branch information
vrenaville committed May 20, 2022
1 parent 1706ecb commit 3104ae8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion attachment_azure/models/ir_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ def _get_container_name(self):
https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#container-names
"""
running_env = os.environ.get("RUNNING_ENV", "dev")
dbname = os.environ.get("DB_NAME", "odoodb")
storage_name = os.environ.get("AZURE_STORAGE_NAME", r"{env}-{db}")
storage_name = storage_name.format(env=running_env, db=self.env.cr.dbname)
storage_name = storage_name.format(env=running_env, db=dbname)
# replace invalid characters by _
storage_name = re.sub(r"[\W_]+", "-", storage_name)
# lowercase, max 63 chars
Expand Down

0 comments on commit 3104ae8

Please sign in to comment.