Spaces:
Sleeping
Sleeping
| import os | |
| import socket | |
| def defineAmbiente(env): | |
| if local_check(): | |
| print("Entorno Local...") | |
| import bridges | |
| if env == 'prod': | |
| llave = bridges.llave_prod | |
| else: #if dev | |
| llave = bridges.llave_sandbox | |
| ga4Key = bridges.GA4_API_SECRET_TARGET | |
| else: | |
| print("Entorno remoto listo...") | |
| if os.getenv("ambiente_stripe") == 'prod': | |
| llave = os.getenv("llave_prod") | |
| ga4Key = os.getenv("GA4_SECRET_PROD") | |
| else: | |
| llave = os.getenv("llave_sandbox") | |
| ga4Key = os.getenv("GA4_SECRET_DEV") | |
| return llave, ga4Key | |
| def local_check(): | |
| hostname = socket.gethostname() | |
| #r-moibe-nowme | |
| print("Hostname: ", hostname) | |
| #Estoy usando el nombre de la app para identificar que estoy corriendola en HF. | |
| if "stripe" in hostname: | |
| print("Ejecutando api en el servidor.") | |
| return False | |
| else: | |
| print("Ejecutando api en local.") | |
| return True |