Spaces:
Runtime error

File size: 945 Bytes
80a8c29
 
 
 
 
 
 
 
 
 
 
 
 
 
d65f8f9
 
 
 
 
 
80a8c29
 
 
 
 
 
 
d65f8f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Run this once to generate .env with a secure encryption key."""
import os
import secrets
from cryptography.fernet import Fernet

env_path = os.path.join(os.path.dirname(__file__), ".env")

if os.path.exists(env_path):
    print(".env already exists, skipping.")
else:
    key = Fernet.generate_key().decode()
    content = f"""SECRET_KEY={secrets.token_urlsafe(32)}
JWT_SECRET_KEY={secrets.token_urlsafe(32)}
ENCRYPTION_KEY={key}

# Supabase / PostgreSQL connection string
# Pegue em: Supabase -> Project Settings -> Database -> Connection string -> URI
DATABASE_URL=postgresql://postgres:SENHA@db.SEU-PROJETO.supabase.co:5432/postgres
AUTO_CREATE_TABLES=false

FLASK_ENV=development
FLASK_DEBUG=1
"""
    with open(env_path, "w") as f:
        f.write(content)
    print(f"Created .env successfully.")
    print(f"Encryption key: {key}")
    print("\n!! Lembre-se de preencher DATABASE_URL com a connection string do seu projeto Supabase.")