Skip to content

Commit 4ae6513

Browse files
committed
feat: entrypoint.sh dosyasındaki izin kontrolü güncellendi; dosya sisteminin yazılabilirliğini kontrol etme eklendi. FirebaseConfig ve application.properties dosyalarında kimlik bilgileri yolları güncellendi; çevresel değişken desteği eklendi.
1 parent 76c2efb commit 4ae6513

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

notification-service/entrypoint.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ if [ -f "/app/credentials/firebase-credentials.json" ]; then
66
echo "Firebase credentials file found at /app/credentials/firebase-credentials.json"
77
export FIREBASE_CONFIG="/app/credentials/firebase-credentials.json"
88
export GOOGLE_APPLICATION_CREDENTIALS="/app/credentials/firebase-credentials.json"
9-
# Dosya izinlerini güvenli bir şekilde düzelt
10-
if touch "/app/credentials/firebase-credentials.json" 2>/dev/null; then
9+
# Check if the filesystem is writable before trying to change permissions
10+
if [ -w "/app/credentials" ] && [ -w "/app/credentials/firebase-credentials.json" ]; then
1111
chmod 644 "/app/credentials/firebase-credentials.json"
1212
else
13-
echo "Note: Firebase credentials file is read-only, skipping permissions change"
13+
echo "Note: Credentials directory or file is read-only, skipping permissions change"
1414
fi
1515
elif [ -f "/app/gcp-credentials.json" ]; then
1616
echo "Firebase credentials file found at /app/gcp-credentials.json"
1717
export FIREBASE_CONFIG="/app/gcp-credentials.json"
1818
export GOOGLE_APPLICATION_CREDENTIALS="/app/gcp-credentials.json"
19-
# Dosya izinlerini güvenli bir şekilde düzelt
20-
if touch "/app/gcp-credentials.json" 2>/dev/null; then
19+
# Check if the filesystem is writable before trying to change permissions
20+
if [ -w "/app" ] && [ -w "/app/gcp-credentials.json" ]; then
2121
chmod 644 "/app/gcp-credentials.json"
2222
else
2323
echo "Note: GCP credentials file is read-only, skipping permissions change"
@@ -26,8 +26,8 @@ elif [ -f "/app/config/firebase-credentials.json" ]; then
2626
echo "Firebase credentials file found at /app/config/firebase-credentials.json"
2727
export FIREBASE_CONFIG="/app/config/firebase-credentials.json"
2828
export GOOGLE_APPLICATION_CREDENTIALS="/app/config/firebase-credentials.json"
29-
# Dosya izinlerini güvenli bir şekilde düzelt
30-
if touch "/app/config/firebase-credentials.json" 2>/dev/null; then
29+
# Check if the filesystem is writable before trying to change permissions
30+
if [ -w "/app/config" ] && [ -w "/app/config/firebase-credentials.json" ]; then
3131
chmod 644 "/app/config/firebase-credentials.json"
3232
else
3333
echo "Note: Config credentials file is read-only, skipping permissions change"

notification-service/src/main/java/com/craftpilot/notificationservice/config/FirebaseConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
public class FirebaseConfig {
2727
private static final Logger logger = LoggerFactory.getLogger(FirebaseConfig.class);
2828

29-
// Update to check multiple credential paths in priority order
30-
@Value("${firebase.credentials.path:${FIREBASE_CONFIG:/app/credentials/firebase-credentials.json}}")
29+
// Update to support both env variables with fallback path
30+
@Value("${firebase.credentials.path:${FIREBASE_CONFIG:${GOOGLE_APPLICATION_CREDENTIALS:/app/credentials/firebase-credentials.json}}}")
3131
private String credentialsPath;
3232

33-
@Value("${firebase.credentials.alternate-paths:/app/gcp-credentials.json,/craftpilot/gcp-credentials.json,/gcp-credentials.json}")
33+
@Value("${firebase.credentials.alternate-paths:/app/gcp-credentials.json,/craftpilot/gcp-credentials.json,/gcp-credentials.json,/app/config/firebase-credentials.json}")
3434
private String alternativeCredentialsPaths;
3535

3636
@Value("${firebase.enabled:true}")

notification-service/src/main/resources/application.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ grpc.server.security.enabled=false
1616

1717
# Firebase configuration
1818
firebase.enabled=true
19-
firebase.credentials.path=${FIREBASE_CONFIG:/app/credentials/firebase-credentials.json}
20-
firebase.credentials.alternate-paths=/app/gcp-credentials.json,/craftpilot/gcp-credentials.json,/gcp-credentials.json
19+
firebase.credentials.path=${FIREBASE_CONFIG:${GOOGLE_APPLICATION_CREDENTIALS:/app/credentials/firebase-credentials.json}}
20+
firebase.credentials.alternate-paths=/app/gcp-credentials.json,/craftpilot/gcp-credentials.json,/gcp-credentials.json,/app/config/firebase-credentials.json

0 commit comments

Comments
 (0)