Spaces:
Running
Running
import os | |
import socket | |
def defineAmbiente(env): | |
if local_check(): | |
print("Entorno Local...") | |
import bridges | |
if env == 'prod': | |
llave = bridges.llave_prod | |
else: | |
llave = bridges.llave_sandbox | |
else: | |
print("Entorno remoto listo...") | |
if os.getenv("ambiente_stripe") == 'prod': | |
llave = os.getenv("llave_prod") | |
else: | |
llave = os.getenv("llave_sandbox") | |
return llave | |
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 |