diff --git a/main.go b/main.go index b56e450..5a40bcf 100644 --- a/main.go +++ b/main.go @@ -43,6 +43,11 @@ func main() { log.SetFlags(log.LstdFlags | log.Lshortfile) } + // Show data loss warning + if config.CleanUp { + promptAbort("`CLEANUP` is set to `true`, which may cause data loss. Are you sure to continue?", 5) + } + // Connect to database var err error db, err = gorm.Open(config.DbDialect, utils.MakeConnectionString(config)) @@ -172,3 +177,11 @@ func migrateLanguages() { } } } + +func promptAbort(message string, timeoutSec int) { + log.Printf("[WARNING] %s.\nTo abort server startup, press Ctrl+C.\n", message) + for i := timeoutSec; i > 0; i-- { + log.Printf("Starting in %d seconds ...\n", i) + time.Sleep(1 * time.Second) + } +} diff --git a/version.txt b/version.txt index bbf649f..3511591 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.7.3 \ No newline at end of file +1.7.4 \ No newline at end of file