Add script-runner configuration capabilities
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
package options
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type (
|
||||
StorageOpt struct {
|
||||
Path string `env:"STORAGE_PATH"`
|
||||
ScriptRunnerOpt struct {
|
||||
Addr string `env:"SCRIPT_RUNNER_ADDR"`
|
||||
MaxBackoffDelay time.Duration `env:"SCRIPT_RUNNER_MAX_BACKOFF_DELAY"`
|
||||
}
|
||||
)
|
||||
|
||||
func Storage(pfix string) (o *StorageOpt) {
|
||||
o = &StorageOpt{
|
||||
Path: "var/store",
|
||||
func ScriptRunner(pfix string) (o *ScriptRunnerOpt) {
|
||||
o = &ScriptRunnerOpt{
|
||||
Addr: "corredor:80",
|
||||
MaxBackoffDelay: time.Minute,
|
||||
}
|
||||
|
||||
fill(o, pfix)
|
||||
|
||||
@@ -50,6 +50,7 @@ type (
|
||||
ProvisionOpt *options.ProvisionOpt
|
||||
SentryOpt *options.SentryOpt
|
||||
StorageOpt *options.StorageOpt
|
||||
ScriptRunner *options.ScriptRunnerOpt
|
||||
|
||||
// DB Connection name, defaults to ServiceName
|
||||
DatabaseName string
|
||||
@@ -188,6 +189,7 @@ func (c *Config) Init() {
|
||||
c.ProvisionOpt = options.Provision(c.ServiceName)
|
||||
c.SentryOpt = options.Sentry(c.EnvPrefix)
|
||||
c.StorageOpt = options.Storage(c.EnvPrefix)
|
||||
c.ScriptRunner = options.ScriptRunner(c.EnvPrefix)
|
||||
|
||||
if c.RootCommandDBSetup == nil {
|
||||
c.RootCommandDBSetup = Runners{func(ctx context.Context, cmd *cobra.Command, c *Config) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user