converts meilisearch key verification to warning
This commit is contained in:
11
db/main.go
11
db/main.go
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user