forked from mtusi2026/mtusi2026lab4
ЛР 4 — вложения S3 и reconciler
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
if [ -e .env ]; then
|
||||
echo '.env already exists; refusing to overwrite it.' >&2
|
||||
exit 2
|
||||
fi
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import os, secrets
|
||||
source=Path('.env.example').read_text(encoding='utf-8')
|
||||
values={
|
||||
'CHANGE-ME-postgres-long-random-secret':secrets.token_urlsafe(32),
|
||||
'CHANGE-ME-random-32-byte-secret':secrets.token_urlsafe(32),
|
||||
'CHANGE-ME-rustfs-root-long-secret':secrets.token_urlsafe(32),
|
||||
'CHANGE-ME-s3-api-long-secret':secrets.token_urlsafe(32),
|
||||
'MESSENGERADMIN':'ROOT'+secrets.token_hex(10).upper(),
|
||||
'MESSENGERAPI':'API'+secrets.token_hex(10).upper(),
|
||||
}
|
||||
for old,new in values.items(): source=source.replace(old,new)
|
||||
p=Path('.env'); p.write_text(source,encoding='utf-8'); os.chmod(p,0o600)
|
||||
PY
|
||||
printf '%s\n' 'Created .env with fresh local credentials (mode 0600).'
|
||||
Reference in New Issue
Block a user