1
0
mirror of https://github.com/dutchcoders/transfer.sh.git synced 2020-11-18 19:53:40 -08:00

updating configurable options

* added option for clamav host
* added temp folder default
* renamed AWS_ACCESS_KEY to AWS_ACCESS_KEY_ID to conform with AWS standard
This commit is contained in:
Remco 2014-11-11 15:33:00 +01:00
parent c5f0f04248
commit 1ecaf94d6d
2 changed files with 16 additions and 9 deletions

View File

@ -195,7 +195,7 @@ func scanHandler(w http.ResponseWriter, r *http.Request) {
reader = r.Body
c := clamd.NewClamd("/tmp/clamd.socket")
c := clamd.NewClamd(config.CLAMAV_DAEMON_HOST)
response, err := c.ScanStream(reader)
if err != nil {

View File

@ -44,21 +44,28 @@ const SERVER_INFO = "transfer.sh"
const _24K = (1 << 20) * 24
var config struct {
AWS_ACCESS_KEY string
AWS_SECRET_KEY string
BUCKET string
VIRUSTOTAL_KEY string
Temp string
AWS_ACCESS_KEY string
AWS_SECRET_KEY string
BUCKET string
VIRUSTOTAL_KEY string
CLAMAV_DAEMON_HOST string "/tmp/clamd.socket"
Temp string
}
var storage Storage
func init() {
config.AWS_ACCESS_KEY = os.Getenv("AWS_ACCESS_KEY")
config.AWS_ACCESS_KEY = os.Getenv("AWS_ACCESS_KEY_ID")
config.AWS_SECRET_KEY = os.Getenv("AWS_SECRET_KEY")
config.BUCKET = os.Getenv("BUCKET")
config.VIRUSTOTAL_KEY = os.Getenv("VIRUSTOTAL_KEY")
config.Temp = ""
if os.Getenv("CLAMAV_DAEMON_HOST") != "" {
config.CLAMAV_DAEMON_HOST = os.Getenv("CLAMAV_DAEMON_HOST")
}
config.Temp = os.TempDir()
}
func main() {
@ -112,7 +119,7 @@ func main() {
r.NotFoundHandler = http.HandlerFunc(notFoundHandler)
port := flag.String("port", "8080", "port number, default: 8080")
temp := flag.String("temp", "", "")
temp := flag.String("temp", config.Temp, "")
basedir := flag.String("basedir", "", "")
logpath := flag.String("log", "", "")
provider := flag.String("provider", "s3", "")