Skip to content
Snippets Groups Projects
Commit 0aa36917 authored by Maciej Wielgosz's avatar Maciej Wielgosz
Browse files

oracle wrapper - reading input from env vars

parent cca432fa
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ import sys
import json
import shutil
import yaml
from urllib.parse import urlparse
from pathlib import Path
from oci.config import validate_config
from oci.object_storage import ObjectStorageClient
......@@ -24,15 +25,24 @@ def run_oracle_wrapper(path_to_config_file):
# create the client
client = ObjectStorageClient(config)
# get the namespace
namespace = client.get_namespace().data
# get the bucket name
bucket_name = 'bucket_lidar_data'
# folder name inside the bucket
input_folder_in_bucket = 'geoslam'
# read system environment variables
input_location = os.environ['OBJ_INPUT_LOCATION']
if input_location is not None:
print('Taking the input from the location ' + input_location)
parsed_url = urlparse(input_location)
input_folder_in_bucket = parsed_url.path[1:]
bucket_name = parsed_url.netloc.split('@')[0]
namespace = parsed_url.netloc.split('@')[1]
else:
print('Taking the input from the default location')
# get the namespace
namespace = client.get_namespace().data
# get the bucket name
bucket_name = 'bucket_lidar_data'
# folder name inside the bucket
input_folder_in_bucket = 'geoslam'
# read the config file from config folder
with open(path_to_config_file) as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment