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