Skip to content

Commit

Permalink
check tag_value 'owned' when found cluster tags
Browse files Browse the repository at this point in the history
  • Loading branch information
athiruma committed Nov 8, 2024
1 parent 841e3d0 commit 9bc1187
Show file tree
Hide file tree
Showing 2 changed files with 247 additions and 124 deletions.
20 changes: 1 addition & 19 deletions cloud_governance/main/environment_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def load_from_env(self):
with open(file_path) as f:
for line in f.readlines():
key, found, value = line.strip().partition("=")
setattr(self, key, value)
setattr(self, key, value.strip('"'))
if not found:
logger.error(f"ERROR: invalid line in {env}: {line.strip()}")
continue
Expand Down Expand Up @@ -63,24 +63,6 @@ def __init__(self):
self.load_from_env()
self.load_from_yaml()

# env files override true ENV. Not best order, but easier to write :/
# .env.generated can be auto-generated (by an external tool) based on the local cluster's configuration.
for env in ".env", ".env.generated":
try:
file_path = os.path.join(os.path.dirname(__file__), env)
with open(file_path) as f:
for line in f.readlines():
key, found, value = line.strip().partition("=")
if not found:
print("ERROR: invalid line in {env}: {line.strip()}")
continue
if key in os.environ:
continue # prefer env to env file
os.environ[key] = value

except FileNotFoundError:
pass # ignore

##################################################################################################
# dynamic parameters - configure for local run
# parameters for running policies
Expand Down
Loading

0 comments on commit 9bc1187

Please sign in to comment.