converts meilisearch key verification to warning

This commit is contained in:
Christian Beutel
2025-03-29 17:08:40 +01:00
parent 88f6d6e67c
commit 3973fe7dd9

View File

@@ -31,30 +31,31 @@ const defaultMeiliMasterKey = "vODkljPcfFANYNepCHyDyGjzAMPcdHnrb6X5KyXQPWo"
// verifySettings checks if the required environment variables are set.
// If they are not set, it logs an error and exits the program.
func verifySettings() {
func verifySettings(app core.App) {
encryptionKey := os.Getenv("POCKETBASE_ENCRYPTION_KEY")
if len(encryptionKey) == 0 || len(encryptionKey) < 32 {
log.Println("POCKETBASE_ENCRYPTION_KEY not set or is shorter than 32 bytes")
app.Logger().Warn("POCKETBASE_ENCRYPTION_KEY not set or is shorter than 32 bytes")
}
meiliMasterKey := os.Getenv("MEILI_MASTER_KEY")
if len(meiliMasterKey) == 0 || len(meiliMasterKey) < 32 {
log.Fatal("MEILI_MASTER_KEY not set or is shorter than 32 bytes")
app.Logger().Warn("MEILI_MASTER_KEY not set or is shorter than 32 bytes")
}
if meiliMasterKey == defaultMeiliMasterKey {
log.Println("MEILI_MASTER_KEY is still set to the default value. Please change it to a secure value.")
app.Logger().Warn("MEILI_MASTER_KEY is still set to the default value. Please change it to a secure value.")
}
}
func main() {
verifySettings()
app := pocketbase.New()
client := initializeMeiliSearch()
verifySettings(app)
registerMigrations(app)
setupEventHandlers(app, client)