updates to backups directory (#1099)

* read BackupDirectory from command line flag

* Change the default backup directory

* mkdir BackupDirectory

* use config for backup file path

* migrateDatabase to the backup directory

* use DoesFileExists

change permission on the directory to 0700

* declare err

* generate backupFile  where needed

* style fix

* more style fixes

* more style fixes
This commit is contained in:
Meisam
2021-06-14 00:28:59 +02:00
committed by GitHub
parent d9a6be2ac6
commit e991199735
4 changed files with 22 additions and 4 deletions

View File

@@ -35,6 +35,7 @@ func main() {
dbFile := flag.String("database", "", "Path to the database file.")
logDirectory := flag.String("logdir", "", "Directory where logs will be written to")
backupDirectory := flag.String("backupdir", "", "Directory where backups will be written to")
enableDebugOptions := flag.Bool("enableDebugFeatures", false, "Enable additional debugging options.")
enableVerboseLogging := flag.Bool("enableVerboseLogging", false, "Enable additional logging.")
restoreDatabaseFile := flag.String("restoreDatabase", "", "Restore an Owncast database backup")
@@ -62,6 +63,10 @@ func main() {
configureLogging(*enableDebugOptions, *enableVerboseLogging)
log.Infoln(config.GetReleaseString())
if *backupDirectory != "" {
config.BackupDirectory = *backupDirectory
}
// Create the data directory if needed
if !utils.DoesFileExists("data") {
os.Mkdir("./data", 0700)