From b8af9fe60f27353bdd5933ed37508b30d4290046 Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Sun, 5 Jun 2016 22:18:24 +0100 Subject: Add AWS S3 and Google GCS virtual filesystems. This allows the signing key to be read directly from S3 using a path like /s3// or /gcs//. --- server/config/config.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'server/config/config.go') 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 } -- cgit v1.2.3