Skip to content

Commit

Permalink
fix: .env path
Browse files Browse the repository at this point in the history
  • Loading branch information
Veivel committed Jun 17, 2024
1 parent 4a965dd commit c8ffe49
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions deploy-stg/infisical.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@
f"infisical export --projectId {project_id} --env {env} --path {path}".split(
" "
),
stdout=open(Path("deploy-stg") / ".env", "w"),
stdout=open(Path(".") / ".env", "w"),
stderr=sys.stderr,
)

# Strip quotes if not quoted (Infisical exports for .env by default is quoted)
if not quoted:
logger.info("Exports are quoted. Running alt logic")
# Read each variable and strip the quotes
with open(Path("deploy-stg") / ".env", "r+") as secret_envs:
with open(Path(".") / ".env", "r+") as secret_envs:
quoted_vars = []
for secret in secret_envs:
secret = secret.strip()
Expand All @@ -81,6 +82,6 @@
quoted_vars.append(f"{key}={value}")

# Write the contents of quoted vars to the .env file
with open(Path("deploy-stg") / ".env", "w+") as env_file:
with open(Path(".") / ".env", "w+") as env_file:
for var in quoted_vars:
env_file.write(var + "\n")

0 comments on commit c8ffe49

Please sign in to comment.