mirror of
https://github.com/h44z/wg-portal.git
synced 2025-11-29 11:56:17 +00:00
set file permissions to 0600 for the sqlite database (#579)
This commit is contained in:
@@ -166,6 +166,9 @@ func NewDatabase(cfg config.DatabaseConfig) (*gorm.DB, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to open sqlite database: %w", err)
|
return nil, fmt.Errorf("failed to open sqlite database: %w", err)
|
||||||
}
|
}
|
||||||
|
if err := os.Chmod(cfg.DSN, 0600); err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to set permissions on sqlite database: %w", err)
|
||||||
|
}
|
||||||
sqlDB, _ := gormDb.DB()
|
sqlDB, _ := gormDb.DB()
|
||||||
sqlDB.SetMaxOpenConns(1)
|
sqlDB.SetMaxOpenConns(1)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user