diff options
Diffstat (limited to 'pkg/config/config.go')
-rw-r--r-- | pkg/config/config.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go index fd19808..902ff0d 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -33,6 +33,8 @@ type ( Scan *scan RootReadme string ListenAddr string + Passphrase string + AESKey string Repositories []*GitRepositoryConfiguration } @@ -52,6 +54,8 @@ type ( ConfigurationRepository struct { rootReadme string listenAddr string + passphrase string + aesKey string repositories []*GitRepositoryConfiguration } ) @@ -71,6 +75,8 @@ func LoadConfigurationRepository(configPath string) (*ConfigurationRepository, e rootReadme: config.RootReadme, listenAddr: config.ListenAddr, repositories: config.Repositories, + passphrase: config.Passphrase, + aesKey: config.AESKey, } if config.Scan.Path != "" { @@ -170,6 +176,16 @@ func parse(r io.Reader) (*configuration, error) { return nil, err } + err = setPassphrase(block, &config.Passphrase) + if err != nil { + return nil, err + } + + err = setAESKey(block, &config.AESKey) + if err != nil { + return nil, err + } + err = setRepositories(block, &config.Repositories) if err != nil { return nil, err @@ -263,6 +279,16 @@ func setRootReadme(block scfg.Block, readme *string) error { return setString(scanDir, readme) } +func setPassphrase(block scfg.Block, listenAddr *string) error { + scanDir := block.Get("passphrase") + return setString(scanDir, listenAddr) +} + +func setAESKey(block scfg.Block, listenAddr *string) error { + scanDir := block.Get("aes-key") + return setString(scanDir, listenAddr) +} + func setListenAddr(block scfg.Block, listenAddr *string) error { scanDir := block.Get("listen-addr") return setString(scanDir, listenAddr) |