mirror of
https://github.com/halverneus/static-file-server.git
synced 2024-11-24 09:05:30 +00:00
Updated alphabetical ordering of flags and 80-column wordwrap.
This commit is contained in:
parent
b881912582
commit
0d80a644ff
@ -63,6 +63,7 @@ the path to the configuration file using the command line option
|
||||
('-c', '-config', '--config').
|
||||
|
||||
```yaml
|
||||
cors: false
|
||||
debug: false
|
||||
folder: /web
|
||||
host: ""
|
||||
@ -72,7 +73,6 @@ show-listing: true
|
||||
tls-cert: ""
|
||||
tls-key: ""
|
||||
url-prefix: ""
|
||||
cors: false
|
||||
```
|
||||
|
||||
Example configuration with possible alternative values:
|
||||
|
@ -34,9 +34,9 @@ DEPENDENCIES
|
||||
|
||||
ENVIRONMENT VARIABLES
|
||||
CORS
|
||||
When set to 'true' it enables resource access from any domain. All responses
|
||||
will include the headers 'Access-Control-Allow-Origin' and 'Access-Control-Allow-Headers'
|
||||
with a wildcard value ('*').
|
||||
When set to 'true' it enables resource access from any domain. All
|
||||
responses will include the headers 'Access-Control-Allow-Origin' and
|
||||
'Access-Control-Allow-Headers' with a wildcard value ('*').
|
||||
DEBUG
|
||||
When set to 'true' enables additional logging, including the
|
||||
configuration used and an access log for each request. IMPORTANT NOTE:
|
||||
@ -89,6 +89,7 @@ CONFIGURATION FILE
|
||||
|
||||
Example config.yml with defaults:
|
||||
----------------------------------------------------------------------------
|
||||
cors: false
|
||||
debug: false
|
||||
folder: /web
|
||||
host: ""
|
||||
@ -98,7 +99,6 @@ CONFIGURATION FILE
|
||||
tls-cert: ""
|
||||
tls-key: ""
|
||||
url-prefix: ""
|
||||
cors: false
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Example config.yml with possible alternative values:
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
var (
|
||||
// Get the desired configuration value.
|
||||
Get struct {
|
||||
Cors bool `yaml:"cors"`
|
||||
Debug bool `yaml:"debug"`
|
||||
Folder string `yaml:"folder"`
|
||||
Host string `yaml:"host"`
|
||||
@ -23,11 +24,11 @@ var (
|
||||
TLSKey string `yaml:"tls-key"`
|
||||
URLPrefix string `yaml:"url-prefix"`
|
||||
Referrers []string `yaml:"referrers"`
|
||||
Cors bool `yaml:cors`
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
corsKey = "CORS"
|
||||
debugKey = "DEBUG"
|
||||
folderKey = "FOLDER"
|
||||
hostKey = "HOST"
|
||||
@ -37,7 +38,6 @@ const (
|
||||
tlsCertKey = "TLS_CERT"
|
||||
tlsKeyKey = "TLS_KEY"
|
||||
urlPrefixKey = "URL_PREFIX"
|
||||
corsKey = "CORS"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -108,6 +108,7 @@ func Log() {
|
||||
// overrideWithEnvVars the default values and the configuration file values.
|
||||
func overrideWithEnvVars() {
|
||||
// Assign envvars, if set.
|
||||
Get.Cors = envAsBool(corsKey, Get.Cors)
|
||||
Get.Debug = envAsBool(debugKey, Get.Debug)
|
||||
Get.Folder = envAsStr(folderKey, Get.Folder)
|
||||
Get.Host = envAsStr(hostKey, Get.Host)
|
||||
@ -117,7 +118,6 @@ func overrideWithEnvVars() {
|
||||
Get.TLSKey = envAsStr(tlsKeyKey, Get.TLSKey)
|
||||
Get.URLPrefix = envAsStr(urlPrefixKey, Get.URLPrefix)
|
||||
Get.Referrers = envAsStrSlice(referrersKey, Get.Referrers)
|
||||
Get.Cors = envAsBool(corsKey, Get.Cors)
|
||||
}
|
||||
|
||||
// validate the configuration.
|
||||
|
Loading…
Reference in New Issue
Block a user