Cosmetic changes in flags.
This commit is contained in:
parent
2abf5a9d7f
commit
92710f7f5a
@ -10,9 +10,12 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var uploadDir *string = flag.String("upload-dir", "/srv/upload", "path to a directory where uploaded files are stored")
|
||||
var keepFileForHours *int64 = flag.Int64("keep-for", 36, "keep files for this much hours")
|
||||
var showVersion *bool = flag.Bool("v", false, "show version")
|
||||
var (
|
||||
uploadDir *string = flag.String("upload-dir", "/srv/upload", "path to a directory where uploaded files are stored")
|
||||
keepForHours *int64 = flag.Int64("keep-for", 36, "keep files for this much hours")
|
||||
|
||||
showVersion *bool = flag.Bool("v", false, "show version")
|
||||
)
|
||||
|
||||
var version string
|
||||
|
||||
@ -31,7 +34,7 @@ func main() {
|
||||
}
|
||||
|
||||
for _, entry := range uploadsDir {
|
||||
if time.Now().UTC().Sub(entry.ModTime().UTC()) >= time.Duration(*keepFileForHours)*time.Hour {
|
||||
if time.Now().UTC().Sub(entry.ModTime().UTC()) >= time.Duration(*keepForHours)*time.Hour {
|
||||
if err := os.Remove(path.Join(*uploadDir, entry.Name())); err != nil {
|
||||
log.Printf("failed to remove file %s: %s", entry.Name(), err)
|
||||
}
|
||||
|
@ -19,12 +19,15 @@ import (
|
||||
"git.arav.su/Arav/httpr"
|
||||
)
|
||||
|
||||
var listenAddress *string = flag.String("listen", "/var/run/dwelling-upload/sock", "listen address (ip:port|unix_path)")
|
||||
var uploadDir *string = flag.String("upload-dir", "/srv/upload", "path to a directory where uploaded files are stored")
|
||||
var keepFileForHours *int = flag.Int("keep-for", 36, "keep files for this much hours")
|
||||
var limitStorage *int64 = flag.Int64("storage", 102400, "storage size in MiB for uploads")
|
||||
var limitFileSize *int64 = flag.Int64("file-size", 128, "max. size in MiB for uploaded files")
|
||||
var showVersion *bool = flag.Bool("v", false, "show version")
|
||||
var (
|
||||
listenAddress *string = flag.String("listen", "/var/run/dwelling-upload/sock", "listen address (ip:port|unix_path)")
|
||||
uploadDir *string = flag.String("upload-dir", "/srv/upload", "directory where uploaded files are stored")
|
||||
keepForHours *int = flag.Int("keep-for", 36, "keep files for this much hours")
|
||||
storageSize *int64 = flag.Int64("storage", 102400, "storage size in MiB for uploads")
|
||||
fileSizeLimit *int64 = flag.Int64("file-size", 128, "max. size in MiB for files")
|
||||
|
||||
showVersion *bool = flag.Bool("v", false, "show version")
|
||||
)
|
||||
|
||||
var version string
|
||||
|
||||
@ -90,7 +93,7 @@ func main() {
|
||||
watcha.WatchForMask(uploadDirNotify, watcher.CrDelMask)
|
||||
|
||||
hand := http.NewUploadHandlers(logFile, *uploadDir, &uploadDirSize, string(hashSalt),
|
||||
*keepFileForHours, *limitStorage, *limitFileSize)
|
||||
*keepForHours, *storageSize, *fileSizeLimit)
|
||||
|
||||
r := httpr.New()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user