-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #51: Add script to upload to blob storage json file containing …
…pipeline
- Loading branch information
Maxence Guindon
committed
Feb 26, 2024
1 parent
63dddec
commit 1d3514e
Showing
6 changed files
with
117 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
import json | ||
|
||
import azure_storage.azure_storage_api as azure_storage_api | ||
|
||
from cryptography.fernet import Fernet | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
key = os.getenv("NACHET_BLOB_PIPELINE_DECRYPTION_KEY") | ||
blob_storage_account_name = os.getenv("NACHET_BLOB_PIPELINE_NAME") | ||
connection_string = os.getenv("NACHET_AZURE_STORAGE_CONNECTION_STRING") | ||
|
||
cipher_suite = Fernet(key) | ||
|
||
with (open("./mock_pipeline_json.json", "r")) as file: | ||
pipelines_json = file.read() | ||
|
||
pipelines_json = json.loads(pipelines_json) | ||
|
||
for model in pipelines_json["models"]: | ||
# crypting endopoint | ||
endpoint = model["endpoint"].encode() | ||
model["endpoint"] = cipher_suite.encrypt(endpoint).decode() | ||
# crypting api_key | ||
api_key = model["api_key"].encode() | ||
model["api_key"] = cipher_suite.encrypt(api_key).decode() | ||
|
||
print(azure_storage_api.insert_new_version_pipeline(pipelines_json, connection_string, blob_storage_account_name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ quart | |
quart-cors | ||
python-dotenv | ||
hypercorn | ||
Pillow | ||
Pillow | ||
cryptography |