aboutsummaryrefslogtreecommitdiff
path: root/server/config
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-06-05 22:18:24 +0100
committerNiall Sheridan <nsheridan@gmail.com>2016-06-05 23:00:46 +0100
commitb8af9fe60f27353bdd5933ed37508b30d4290046 (patch)
treefcc12e2f39f9fe4d7aa7d37fd4114309d3362c38 /server/config
parenta52d19e9e78d08643ffd4aee0483515d8bae2939 (diff)
Add AWS S3 and Google GCS virtual filesystems.
This allows the signing key to be read directly from S3 using a path like /s3/<bucket>/<path/to/signing.key> or /gcs/<bucket>/<path/to/signing.key>.
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
}