From 77c0b9449a106e538d56547cab1dd3a65bbd4826 Mon Sep 17 00:00:00 2001 From: shailendra suman Date: Mon, 28 Oct 2024 18:34:37 +0530 Subject: [PATCH] [APPSERV-15780]-helo-world-take3 --- app.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index dbac14f..87f011a 100644 --- a/app.py +++ b/app.py @@ -1,15 +1,21 @@ +# app.py import os def main(): - # Fetch the password from environment variables - password = os.getenv('MY_PASSWORD') - - if password: - print(f"Hello, World! The fetched password is: {password}") - else: - print("Hello, World! No password found.") + # Read template from ConfigMap + with open("/config/template", "r") as file: + template = file.read() + + # Read password from externalsecret + with open("/secret/password", "r") as file: + password = file.read().strip() + + # Replace .password in the template + message = template.replace(".password", password) + print(message) if __name__ == "__main__": main() +