From 142a02b04aec3ac4f56583b34934e7723ae9d5f4 Mon Sep 17 00:00:00 2001 From: Jesse Nelson Date: Fri, 22 Jul 2016 11:41:42 -0700 Subject: [PATCH] cookbook cache for github now configurable --- config/config.go | 27 ++++++++++++++------------- main.go | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/config/config.go b/config/config.go index 2f410dc..b275d83 100644 --- a/config/config.go +++ b/config/config.go @@ -10,22 +10,23 @@ import ( "github.com/jessevdk/go-flags" ) -// CLI Options +// Options describes all the cli flags that can be passed type Options struct { - Port int `short:"p" long:"port" description:"Port to listen on" default:"443" env:"BARYON_PORT"` - Bind string `short:"b" long:"bind" description:"Ip address to bind to" default:"0.0.0.0" env:"BARYON_BIND"` - Secret string `short:"s" long:"secret" description:"The web-hook secret" env:"BARYON_HOOK_SECRET"` - Key string `short:"k" long:"key" description:"Specify a Key file to enable server to start TLS" env:"BARYON_KEY"` - Cert string `short:"c" long:"cert" description:"Cert file for TLS" env:"BARYON_CERT"` - Org string `short:"o" long:"org" description:"Github Org to find cookbooks" env:"BARYON_GITHUB_ORG"` - Token string `short:"t" long:"token" description:"Github API token to use when connecting" env:"BARYON_GITHUB_TOKEN"` - SyncInterval time.Duration `short:"i" long:"interval" description:"Interval to perform full sync against github repos. Supports Golang duration formatting '1h2m'... etc." default:"12h" env:"BARYON_INTERVAL"` - NoSync bool `long:"no-sync" description:"Do NOT perform a github scan/sync when starting. Periodic sync will still fire" env:"BARYON_NOSYNC"` - BerksOnly bool `long:"berks-only" description:"Only use berks compatable version tags in the universe" env:"BARYON_BERKSONLY"` - TLS bool + Port int `short:"p" long:"port" description:"Port to listen on" default:"443" env:"BARYON_PORT"` + Bind string `short:"b" long:"bind" description:"Ip address to bind to" default:"0.0.0.0" env:"BARYON_BIND"` + Secret string `short:"s" long:"secret" description:"The web-hook secret" env:"BARYON_HOOK_SECRET"` + Key string `short:"k" long:"key" description:"Specify a Key file to enable server to start TLS" env:"BARYON_KEY"` + Cert string `short:"c" long:"cert" description:"Cert file for TLS" env:"BARYON_CERT"` + Org string `short:"o" long:"org" description:"Github Org to find cookbooks" env:"BARYON_GITHUB_ORG"` + Token string `short:"t" long:"token" description:"Github API token to use when connecting" env:"BARYON_GITHUB_TOKEN"` + SyncInterval time.Duration `short:"i" long:"interval" description:"Interval to perform full sync against github repos. Supports Golang duration formatting '1h2m'... etc." default:"12h" env:"BARYON_INTERVAL"` + NoSync bool `long:"no-sync" description:"Do NOT perform a github scan/sync when starting. Periodic sync will still fire" env:"BARYON_NOSYNC"` + BerksOnly bool `long:"berks-only" description:"Only use berks compatable version tags in the universe" env:"BARYON_BERKSONLY"` + MaxGithubVersions int `logn:"max-github-versions" description:"Max number of versions to scan when looking at github repos" default:"20" env:"BARYON_MAX_VERSIONS"` + TLS bool } -// Opts is the application config struct +// Opts is the application config struct that we allow external access too var Opts Options func init() { diff --git a/main.go b/main.go index 570140a..9d6620e 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,7 @@ func main() { Token: config.Opts.Token, Org: config.Opts.Org, SyncInterval: config.Opts.SyncInterval, - MaxVersions: 5, + MaxVersions: config.Opts.MaxGithubVersions, } ghs := gh.New(ghsConfig, u) var wg sync.WaitGroup