Verify clean clone and restrict migration secrets

This commit is contained in:
2026-10-29 21:42:29 +03:00
parent 99c87315cf
commit 3a3ebd2115
6 changed files with 297 additions and 11 deletions
+10 -10
View File
@@ -60,6 +60,16 @@ func run() error {
if err != nil {
return err
}
startup, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
pool, err := database.Open(startup, databaseURL)
if err != nil {
return err
}
defer pool.Close()
if len(os.Args) == 2 && os.Args[1] == "migrate" {
return database.Migrate(startup, pool)
}
cacheURL, err := secret("CACHE_URL_FILE")
if err != nil {
return err
@@ -72,16 +82,6 @@ func run() error {
if err != nil || len(key) != 32 {
return fmt.Errorf("invalid cursor key")
}
startup, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
pool, err := database.Open(startup, databaseURL)
if err != nil {
return err
}
defer pool.Close()
if len(os.Args) == 2 && os.Args[1] == "migrate" {
return database.Migrate(startup, pool)
}
opts, err := redis.ParseURL(cacheURL)
if err != nil {
return fmt.Errorf("invalid cache configuration")