Spaces:
Running
Running
Configuración firestore ya para dev y prod
Browse files- autenticacion.py +2 -2
- config_creator.py +2 -5
autenticacion.py
CHANGED
@@ -22,12 +22,12 @@ def defineAmbiente(env):
|
|
22 |
print("Ambiente stripe es: ", os.getenv("ambiente_stripe"))
|
23 |
llave = os.getenv("STRIPE_KEY_PROD") #Acceso a HF
|
24 |
webhook = os.getenv("STRIPE_WEBHOOK_SECRET_PROD")
|
25 |
-
config_creator.creaConfigFirestore()
|
26 |
else: #if dev
|
27 |
print("Ambiente stripe es: ", os.getenv("ambiente_stripe"))
|
28 |
llave = os.getenv("STRIPE_KEY_SANDBOX") #Acceso a HF
|
29 |
webhook = os.getenv("STRIPE_WEBHOOK_SECRET_SANDBOX")
|
30 |
-
config_creator.creaConfigFirestore()
|
31 |
|
32 |
return llave, webhook
|
33 |
|
|
|
22 |
print("Ambiente stripe es: ", os.getenv("ambiente_stripe"))
|
23 |
llave = os.getenv("STRIPE_KEY_PROD") #Acceso a HF
|
24 |
webhook = os.getenv("STRIPE_WEBHOOK_SECRET_PROD")
|
25 |
+
config_creator.creaConfigFirestore('configuracion_prod') #La secret var de HF respecto a prod.
|
26 |
else: #if dev
|
27 |
print("Ambiente stripe es: ", os.getenv("ambiente_stripe"))
|
28 |
llave = os.getenv("STRIPE_KEY_SANDBOX") #Acceso a HF
|
29 |
webhook = os.getenv("STRIPE_WEBHOOK_SECRET_SANDBOX")
|
30 |
+
config_creator.creaConfigFirestore('configuracion_dev') #La secret var de HF respecto a dev.
|
31 |
|
32 |
return llave, webhook
|
33 |
|
config_creator.py
CHANGED
@@ -1,13 +1,10 @@
|
|
1 |
import os
|
2 |
import json
|
3 |
|
4 |
-
def creaConfigFirestore():
|
5 |
-
|
6 |
-
print("Entré a creaConfigFirestore...")
|
7 |
|
8 |
# Paso 1: Obtener la variable de entorno
|
9 |
-
firestore_config_str = os.getenv(
|
10 |
-
#os.makedirs(os.path.dirname("archivos/config.json"), exist_ok=True)
|
11 |
|
12 |
if firestore_config_str is None:
|
13 |
print("Error: La variable de entorno 'configuracion' no está definida.")
|
|
|
1 |
import os
|
2 |
import json
|
3 |
|
4 |
+
def creaConfigFirestore(configuracion):
|
|
|
|
|
5 |
|
6 |
# Paso 1: Obtener la variable de entorno
|
7 |
+
firestore_config_str = os.getenv(configuracion)
|
|
|
8 |
|
9 |
if firestore_config_str is None:
|
10 |
print("Error: La variable de entorno 'configuracion' no está definida.")
|