1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

fixed missing creation of database directory

This commit is contained in:
postmannen 2024-11-22 21:47:48 +01:00
parent 693a6b819e
commit b9934a7503

View file

@ -386,6 +386,13 @@ func (s *server) Start() {
// startAuditLog will start up the logging of all messages to audit file
func (s *server) startAuditLog(ctx context.Context) {
// Check if database folder exists, if not create it
if _, err := os.Stat(s.configuration.DatabaseFolder); os.IsNotExist(err) {
err := os.MkdirAll(s.configuration.DatabaseFolder, 0770)
if err != nil {
log.Fatalf("error: failed to create socket folder directory %v: %v", s.configuration.SocketFolder, err)
}
}
storeFile := filepath.Join(s.configuration.DatabaseFolder, "store.log")
f, err := os.OpenFile(storeFile, os.O_APPEND|os.O_RDWR|os.O_CREATE, 0660)