mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-07 05:42:42 +00:00
Config options for S3 storage. #15
This commit is contained in:
+24
-13
@@ -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
|
||||
|
||||
+14
-1
@@ -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"+
|
||||
"}")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user