14 lines
545 B
Python
14 lines
545 B
Python
"""Create local Compose secrets once; keep existing credentials on subsequent runs."""
|
|
from pathlib import Path
|
|
import secrets
|
|
|
|
target = Path(__file__).resolve().parent.parent / '.env.local'
|
|
if target.exists():
|
|
print('.env.local already exists; keeping it.')
|
|
else:
|
|
target.touch(mode=0o600, exist_ok=False)
|
|
target.write_text(''.join(f'{name}={secrets.token_hex(size)}\n' for name, size in [
|
|
('MYSQL_PASSWORD', 24), ('MYSQL_ROOT_PASSWORD', 24), ('JWT_KEY', 48), ('ADMIN_PASSWORD', 24),
|
|
]))
|
|
print('Created .env.local.')
|