diff --git a/setup_blocks.py b/setup_blocks.py index b80a529..5334a15 100644 --- a/setup_blocks.py +++ b/setup_blocks.py @@ -4,6 +4,7 @@ Setup Prefect Blocks from environment variables. import os from prefect_aws import AwsCredentials +from prefect.blocks.system import Secret def setup_blocks(): @@ -24,6 +25,14 @@ def setup_blocks(): print("✅ Block 'garage-credentials' created/updated") else: print("⚠️ Skipping garage-credentials: missing environment variables") + + # PostgreSQL password pour netbox + pg_password = os.environ.get("PG_PASSWORD") + if pg_password: + Secret(value=pg_password).save("netbox-db-password", overwrite=True) + print("✅ Block 'netbox-db-password' created/updated") + else: + print("⚠️ Skipping netbox-db-password: PG_PASSWORD not set") if __name__ == "__main__":