mirror of
https://github.com/thiagoralves/OpenPLC_v3.git
synced 2026-09-24 07:23:59 +08:00
[RTOP-26] Update background_installer.sh
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
parent
cad2281421
commit
e0f35c32ac
@@ -203,12 +203,26 @@ function install_libsnap7 {
|
||||
}
|
||||
|
||||
function generate_env() {
|
||||
# Check if .env already exists and prompt user
|
||||
if [ -f .env ]; then
|
||||
echo "Warning: .env file already exists. Backup and recreate? (y/N)"
|
||||
read -r response
|
||||
if [[ ! "$response" =~ ^[Yy]$ ]]; then
|
||||
echo "Skipping .env generation."
|
||||
return
|
||||
fi
|
||||
cp .env .env.backup
|
||||
fi
|
||||
|
||||
cat <<EOF > .env
|
||||
FLASK_ENV=development
|
||||
SQLALCHEMY_DATABASE_URI=sqlite:///restapi.db
|
||||
JWT_SECRET_KEY=$(openssl rand -hex 32)
|
||||
PEPPER=$(openssl rand -hex 32)
|
||||
EOF
|
||||
|
||||
# Set restrictive permissions (readable only by owner)
|
||||
chmod 600 .env
|
||||
echo ".env file created with random JWT_SECRET_KEY and PEPPER."
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user