1
0

Do not log how much files was deleted. Useless info, keep only error logs.

And removed configPath flag as well.
This commit is contained in:
Alexander Andreev 2023-05-25 02:10:35 +04:00
parent 203c0158ce
commit 55ba1fd67d
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 0 additions and 17 deletions

View File

@ -1,8 +1,6 @@
package main package main
import ( import (
"dwelling-upload/pkg/logging"
"dwelling-upload/pkg/utils"
"flag" "flag"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
@ -12,7 +10,6 @@ import (
"time" "time"
) )
var configPath *string = flag.String("conf", "config.yaml", "path to configuration file")
var uploadDir *string = flag.String("upload-dir", "/srv/uploads", "path to a directory where uploaded files are stored") var uploadDir *string = flag.String("upload-dir", "/srv/uploads", "path to a directory where uploaded files are stored")
var keepFileForHours *int64 = flag.Int64("keep-for", 36, "keep files for this much hours") var keepFileForHours *int64 = flag.Int64("keep-for", 36, "keep files for this much hours")
var showVersion *bool = flag.Bool("v", false, "show version") var showVersion *bool = flag.Bool("v", false, "show version")
@ -28,12 +25,6 @@ func main() {
return return
} }
logClean, err := logging.New(path.Join(os.Getenv("LOGS_DIRECTORY"), "clean.log"))
if err != nil {
log.Fatalln("failed to open clean logger:", err)
}
defer logClean.Close()
uploadsDir, err := ioutil.ReadDir(*uploadDir) uploadsDir, err := ioutil.ReadDir(*uploadDir)
if err != nil { if err != nil {
log.Fatalf("failed to open directory %s: %s\n", *uploadDir, err) log.Fatalf("failed to open directory %s: %s\n", *uploadDir, err)
@ -52,10 +43,4 @@ func main() {
} }
} }
} }
_, _, cFSz := utils.ConvertFileSize(deletedSize)
if deletedCount > 0 {
logClean.Println(deletedCount, cFSz)
}
} }

View File

@ -13,8 +13,6 @@ ReadWritePaths=/srv/upload
NoExecPaths=/ NoExecPaths=/
ExecPaths=/usr/bin/dwelling-upload-clean ExecPaths=/usr/bin/dwelling-upload-clean
LogsDirectory=dwelling-upload
AmbientCapabilities= AmbientCapabilities=
CapabilityBoundingSet= CapabilityBoundingSet=