Move file expiry time to config file
This commit is contained in:
parent
579a2ac26b
commit
979c7e34d4
@ -4,3 +4,4 @@ vhost = "hardfiles.org"
|
||||
dbfile = "dbfile.db"
|
||||
filelen = 6
|
||||
folder = "files"
|
||||
fileexpiry = 86400
|
3
main.go
3
main.go
@ -29,6 +29,7 @@ type Config struct {
|
||||
DBFile string `toml:"dbfile"`
|
||||
FileLen int `toml:"filelen"`
|
||||
FileFolder string `toml:"folder"`
|
||||
FileExpirySeconds int `toml:"fileexpiry"`
|
||||
}
|
||||
|
||||
func LoadConf() {
|
||||
@ -120,7 +121,7 @@ func CheckFile(name string) bool { // false if doesn't exist, true if exists
|
||||
|
||||
func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// expiry sanitize
|
||||
twentyfour := int64(86400)
|
||||
twentyfour := int64(conf.FileExpirySeconds)
|
||||
|
||||
file, _, err := r.FormFile("file")
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user