aboutsummaryrefslogtreecommitdiff
path: root/server/config
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-06-06 13:49:21 +0100
committerNiall Sheridan <nsheridan@gmail.com>2016-06-06 13:49:21 +0100
commit5ca59399fe0880368f88d17c0c9d781d836969c6 (patch)
treefe9eaea4ae4da974a237dd6f004fe3bad272eda1 /server/config
parent5166bbbf3e084f7b6ab9034f2f7590c1031bc266 (diff)
parentb8af9fe60f27353bdd5933ed37508b30d4290046 (diff)
Merge pull request #16 from nsheridan/s3
Add AWS S3 and Google GCS virtual filesystems
Diffstat (limited to 'server/config')
-rw-r--r--server/config/config.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/config/config.go b/server/config/config.go
index fae823b..648cf46 100644
--- a/server/config/config.go
+++ b/server/config/config.go
@@ -13,6 +13,7 @@ type Config struct {
Server `mapstructure:"server"`
Auth `mapstructure:"auth"`
SSH `mapstructure:"ssh"`
+ AWS `mapstructure:"aws"`
}
// unmarshalled holds the raw config.
@@ -20,6 +21,7 @@ type unmarshalled struct {
Server []Server `mapstructure:"server"`
Auth []Auth `mapstructure:"auth"`
SSH []SSH `mapstructure:"ssh"`
+ AWS []AWS `mapstructure:"aws"`
}
// Server holds the configuration specific to the web server and sessions.
@@ -48,6 +50,14 @@ type SSH struct {
Permissions []string `mapstructure:"permissions"`
}
+// AWS holds Amazon AWS configuration.
+// AWS can also be configured using SDK methods.
+type AWS struct {
+ Region string `mapstructure:"region"`
+ AccessKey string `mapstructure:"access_key"`
+ SecretKey string `mapstructure:"secret_key"`
+}
+
func verifyConfig(u *unmarshalled) error {
var err error
if len(u.SSH) == 0 {
@@ -59,6 +69,10 @@ func verifyConfig(u *unmarshalled) error {
if len(u.Server) == 0 {
err = multierror.Append(errors.New("missing server config block"))
}
+ if len(u.AWS) == 0 {
+ // AWS config is optional
+ u.AWS = append(u.AWS, AWS{})
+ }
return err
}
@@ -80,5 +94,6 @@ func ReadConfig(r io.Reader) (*Config, error) {
Server: u.Server[0],
Auth: u.Auth[0],
SSH: u.SSH[0],
+ AWS: u.AWS[0],
}, nil
}