diff --git a/system/t02_config/CreateConfigTest_gold b/system/t02_config/CreateConfigTest_gold index cb0ff232..be775ccc 100644 --- a/system/t02_config/CreateConfigTest_gold +++ b/system/t02_config/CreateConfigTest_gold @@ -1,5 +1,5 @@ { - "rootDir": "${HOME}/.aptly", + "rootDir": "/Users/smira/.aptly", "downloadConcurrency": 4, "downloadSpeedLimit": 0, "architectures": [], @@ -11,5 +11,6 @@ "gpgDisableVerify": false, "downloadSourcePackages": false, "ppaDistributorID": "ubuntu", - "ppaCodename": "" + "ppaCodename": "", + "S3PublishRoots": {} } \ No newline at end of file diff --git a/utils/config.go b/utils/config.go index 12379783..231677d6 100644 --- a/utils/config.go +++ b/utils/config.go @@ -8,19 +8,29 @@ import ( // ConfigStructure is structure of main configuration type ConfigStructure struct { - RootDir string `json:"rootDir"` - DownloadConcurrency int `json:"downloadConcurrency"` - DownloadLimit int64 `json:"downloadSpeedLimit"` - Architectures []string `json:"architectures"` - DepFollowSuggests bool `json:"dependencyFollowSuggests"` - DepFollowRecommends bool `json:"dependencyFollowRecommends"` - DepFollowAllVariants bool `json:"dependencyFollowAllVariants"` - DepFollowSource bool `json:"dependencyFollowSource"` - GpgDisableSign bool `json:"gpgDisableSign"` - GpgDisableVerify bool `json:"gpgDisableVerify"` - DownloadSourcePackages bool `json:"downloadSourcePackages"` - PpaDistributorID string `json:"ppaDistributorID"` - PpaCodename string `json:"ppaCodename"` + RootDir string `json:"rootDir"` + DownloadConcurrency int `json:"downloadConcurrency"` + DownloadLimit int64 `json:"downloadSpeedLimit"` + Architectures []string `json:"architectures"` + DepFollowSuggests bool `json:"dependencyFollowSuggests"` + DepFollowRecommends bool `json:"dependencyFollowRecommends"` + DepFollowAllVariants bool `json:"dependencyFollowAllVariants"` + DepFollowSource bool `json:"dependencyFollowSource"` + GpgDisableSign bool `json:"gpgDisableSign"` + GpgDisableVerify bool `json:"gpgDisableVerify"` + DownloadSourcePackages bool `json:"downloadSourcePackages"` + PpaDistributorID string `json:"ppaDistributorID"` + PpaCodename string `json:"ppaCodename"` + S3PublishRoots map[string]S3PublishRoot `json:"S3PublishRoots"` +} + +type S3PublishRoot struct { + Region string `json:"region"` + Bucket string `json:"bucket"` + AccessKeyID string `json:"awsAccessKeyID"` + SecretAccessKey string `json:"awsSecretAccessKey"` + Prefix string `json:"prefix"` + ACL string `json:"acl"` } // Config is configuration for aptly, shared by all modules @@ -38,6 +48,7 @@ var Config = ConfigStructure{ DownloadSourcePackages: false, PpaDistributorID: "ubuntu", PpaCodename: "", + S3PublishRoots: map[string]S3PublishRoot{}, } // LoadConfig loads configuration from json file diff --git a/utils/config_test.go b/utils/config_test.go index ebac30ba..8621c8d1 100644 --- a/utils/config_test.go +++ b/utils/config_test.go @@ -29,6 +29,9 @@ func (s *ConfigSuite) TestSaveConfig(c *C) { s.config.RootDir = "/tmp/aptly" s.config.DownloadConcurrency = 5 + s.config.S3PublishRoots = map[string]S3PublishRoot{"test": S3PublishRoot{ + Region: "us-east-1", + Bucket: "repo"}} err := SaveConfig(configname, &s.config) c.Assert(err, IsNil) @@ -54,7 +57,17 @@ func (s *ConfigSuite) TestSaveConfig(c *C) { " \"gpgDisableVerify\": false,\n"+ " \"downloadSourcePackages\": false,\n"+ " \"ppaDistributorID\": \"\",\n"+ - " \"ppaCodename\": \"\"\n"+ + " \"ppaCodename\": \"\",\n"+ + " \"S3PublishRoots\": {\n"+ + " \"test\": {\n"+ + " \"region\": \"us-east-1\",\n"+ + " \"bucket\": \"repo\",\n"+ + " \"awsAccessKeyID\": \"\",\n"+ + " \"awsSecretAccessKey\": \"\",\n"+ + " \"prefix\": \"\",\n"+ + " \"acl\": \"\"\n"+ + " }\n"+ + " }\n"+ "}") }