summaryrefslogtreecommitdiff
path: root/_____/http/config.go
diff options
context:
space:
mode:
Diffstat (limited to '_____/http/config.go')
-rw-r--r--_____/http/config.go88
1 files changed, 0 insertions, 88 deletions
diff --git a/_____/http/config.go b/_____/http/config.go
deleted file mode 100644
index bd8cec5e..00000000
--- a/_____/http/config.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package http
-
-import (
- "fmt"
- "github.com/spiral/roadrunner/service"
- "github.com/spiral/roadrunner/_____/utils"
- "os"
- "path"
- "strings"
- "github.com/spiral/roadrunner/http"
-)
-
-// Configures RoadRunner HTTP server.
-type Config struct {
- // serve enables static file serving from desired root directory.
- ServeStatic bool
-
- Static *http.FsConfig
-
- // Root directory, required when serve set to true.
- Root string
-
- // Dir contains name of temporary directory to store uploaded files passed to underlying PHP process.
- TmpDir string
-
- // MaxRequest specified max size for payload body in bytes, set 0 to unlimited.
- MaxRequest int64
-
- // Forbid specifies list of file extensions which are forbidden for uploads.
- // Example: .php, .exe, .bat, .htaccess and etc.
- ForbidUploads []string
-}
-
-// Forbid must return true if file extension is not allowed for the upload.
-func (cfg Config) Forbidden(filename string) bool {
- ext := strings.ToLower(path.Ext(filename))
-
- for _, v := range cfg.ForbidUploads {
- if ext == v {
- return true
- }
- }
-
- return false
-}
-
-type serviceConfig struct {
- Enabled bool
- Host string
- Port string
- MaxRequest string
- Static struct {
- Serve bool
- Root string
- }
-
- Uploads struct {
- TmpDir string
- Forbid []string
- }
-
- Pool service.PoolConfig
-
- //todo: verbose ?
-}
-
-func (cfg *serviceConfig) httpAddr() string {
- return fmt.Sprintf("%s:%v", cfg.Host, cfg.Port)
-}
-
-func (cfg *serviceConfig) httpConfig() *Config {
- tmpDir := cfg.Uploads.TmpDir
- if tmpDir == "" {
- tmpDir = os.TempDir()
- }
-
- return &Config{
- ServeStatic: cfg.Static.Serve,
- Root: cfg.Static.Root,
- TmpDir: tmpDir,
- MaxRequest: utils.ParseSize(cfg.MaxRequest),
- ForbidUploads: cfg.Uploads.Forbid,
- }
-}
-
-func (cfg *serviceConfig) Valid() error {
- return nil
-}