-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
47 lines (41 loc) · 1.56 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
47 lines (41 loc) · 1.56 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -e
# SecurityNexus başlatma betiği
echo "[*] SecurityNexus Docker ortamına hoş geldiniz"
echo "[*] Yapılandırma kontrol ediliyor..."
# Config dosyaları için gerekli klasörleri kontrol et
for dir in reports history config; do
if [ ! -d "/app/$dir" ]; then
echo "[*] /app/$dir klasörü oluşturuluyor..."
mkdir -p "/app/$dir"
fi
done
# Config.json dosyasının varlığını kontrol et
if [ ! -f "/app/config/config.json" ]; then
echo "[*] /app/config/config.json bulunamadı, örnek kullanılıyor..."
if [ -f "/app/config/config.json.example" ]; then
cp "/app/config/config.json.example" "/app/config/config.json"
echo "[+] Örnek yapılandırma dosyası kopyalandı."
else
echo "[!] Uyarı: Örnek yapılandırma dosyası bulunamadı!"
echo "{}" > "/app/config/config.json"
echo "[+] Boş yapılandırma dosyası oluşturuldu."
fi
fi
# requirements.txt dosyasını kontrol et
if grep -q "eth-brownie" "/app/config/requirements.txt"; then
echo "[*] requirements.txt içindeki eth-brownie paketi devre dışı bırakılıyor..."
sed -i '/eth-brownie/d' /app/config/requirements.txt
fi
# Yetki ayarlarını kontrol et
if [ "$(id -u)" = "0" ]; then
echo "[*] Root kullanıcısı tespit edildi, yetkileri düzenliyorum..."
chown -R securitynexus:securitynexus /app/reports
chown -R securitynexus:securitynexus /app/history
chown -R securitynexus:securitynexus /app/config
echo "[*] SecurityNexus başlatılıyor..."
exec gosu securitynexus "$@"
else
echo "[*] SecurityNexus başlatılıyor..."
exec "$@"
fi