diff --git a/vs_starter/config.py b/vs_starter/config.py index d3c28cff27a849eb5fa1313d2ee04c4ab753c9ec..4da6196865a1d9dc930c0a42b111bbfdbc47e483 100644 --- a/vs_starter/config.py +++ b/vs_starter/config.py @@ -12,7 +12,7 @@ def render_config( ) -> None: # get helm data configmaps = get_helm_data(helm_config_path, file_type="configmap") - env = get_helm_data(helm_config_path, file_type="registrar-deployment", index=True) + env = get_helm_data(helm_config_path, file_type="deployment", index=True) # extract envs envs = extract_env_vars(env) @@ -38,11 +38,21 @@ def get_helm_data(helm_config_path: str, file_type: str, index: bool = False) -> if not os.path.isdir(helm_config_path): raise ValueError(f"{helm_config_path} is not a directory") - files = [ - os.path.join(helm_config_path, f) - for f in os.listdir(helm_config_path) - if os.path.isfile(os.path.join(helm_config_path, f)) and file_type in f - ] + to_remove = ["redis", "renderer", "database"] + rendered_templates = os.listdir(helm_config_path) + + for template in to_remove: + rendered_templates.remove(template) + + files = [] + for template_dir in rendered_templates: + template_path = os.path.join(helm_config_path, template_dir) + template_path = os.path.join(template_path, "templates") + for f in os.listdir(template_path): + if file_type in f and os.path.isfile( + template_file := os.path.join(template_path, f) + ): + files.append(template_file) if index: return files[0]