Skip to content

Commit f61c0a3

Browse files
Split the parsing of input and the exporting of the variables for
reuse
1 parent 3b4cca3 commit f61c0a3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lambda_local/environment_variables.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
import os
33

44

5+
def export_variables(environment_variables):
6+
for env_name, env_value in environment_variables.items():
7+
os.environ[str(env_name)] = str(env_value)
8+
9+
510
def set_environment_variables(json_file_path):
611
"""
712
Read and set environment variables from a flat json file.
@@ -25,5 +30,4 @@ def set_environment_variables(json_file_path):
2530
with open(json_file_path) as json_file:
2631
env_vars = json.loads(json_file.read())
2732

28-
for env_name, env_value in env_vars.items():
29-
os.environ[str(env_name)] = str(env_value)
33+
export_variables(env_vars)

0 commit comments

Comments
 (0)