# parameter_utils.py import os import boto3 ssm = boto3.client('ssm', region_name='ap-southeast-3') def init_secret(path): next_token = None while True: response = ssm.get_parameters_by_path( Path=path, Recursive=True, WithDecryption=True, NextToken=next_token if next_token else "", ) parameters = response.get("Parameters", []) for parameter in parameters: key = parameter.get("Name").split("/")[-1] value = parameter.get("Value") os.environ[key] = value print(f"Set env variable {key}") next_token = response.get("NextToken") if not next_token: break