Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# syntax=docker/dockerfile:1

# GO_VERSION is updated automatically to match go.mod, see Makefile
ARG GO_VERSION=1.26.0
ARG GO_VERSION_SHA256=sha256:d4c4845f5d60c6a974c6000ce58ae079328d03ab7f721a0734277e69905473e5
ARG GO_VERSION=1.26.1
ARG GO_VERSION_SHA256=sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f6c5bd6be49ed82039
ARG ALPINE_VERSION=3.23
ARG ALPINE_VERSION_SHA256=sha256:51183f2cfa6320055da30872f211093f9ff1d3cf06f39a0bdb212314c5dc7375
ARG ALPINE_VERSION_SHA256=sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION}@${GO_VERSION_SHA256} AS builder
ARG VERSION
ARG REVISION
ARG COMMIT_HASH
ARG ENTERPRISE_TOKEN

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / oss / docker-build (self-hosted, Linux, ARM64, ubuntu-22, rudderlabs/develop-rudder-server:pr-6753-arm6...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / oss / docker-build (self-hosted, Linux, ARM64, ubuntu-22, rudderlabs/develop-rudder-server:pr-6753-arm6...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / oss / docker-build (ubuntu-latest, rudderlabs/develop-rudder-server:pr-6753-amd64, org.opencontainers.i...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / oss / docker-build (ubuntu-latest, rudderlabs/develop-rudder-server:pr-6753-amd64, org.opencontainers.i...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / enterprise-ecr / docker-build (self-hosted, Linux, ARM64, ubuntu-22, 422074288268.dkr.ecr.us-east-1.amazonaws.com/...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / enterprise-ecr / docker-build (self-hosted, Linux, ARM64, ubuntu-22, 422074288268.dkr.ecr.us-east-1.amazonaws.com/...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / enterprise-ecr / docker-build (ubuntu-latest, 422074288268.dkr.ecr.us-east-1.amazonaws.com/rudderstack/develop-rud...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / enterprise-ecr / docker-build (ubuntu-latest, 422074288268.dkr.ecr.us-east-1.amazonaws.com/rudderstack/develop-rud...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / enterprise-ecr-race / docker-build (ubuntu-latest, 422074288268.dkr.ecr.us-east-1.amazonaws.com/rudderstack/develop-rud...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / enterprise-ecr-race / docker-build (ubuntu-latest, 422074288268.dkr.ecr.us-east-1.amazonaws.com/rudderstack/develop-rud...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / enterprise-ecr-race / docker-build (self-hosted, Linux, ARM64, ubuntu-22, 422074288268.dkr.ecr.us-east-1.amazonaws.com/...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 13 in Dockerfile

View workflow job for this annotation

GitHub Actions / enterprise-ecr-race / docker-build (self-hosted, Linux, ARM64, ubuntu-22, 422074288268.dkr.ecr.us-east-1.amazonaws.com/...

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "ENTERPRISE_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ARG RACE_ENABLED=false
ARG CGO_ENABLED=0
ARG PKG_NAME=github.com/rudderlabs/release-demo
Expand Down
6 changes: 3 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ func getHealthVal(jobsDB jobsdb.JobsDB) (bool, string) {
healthy = false
}
enabledRouter := "TRUE"
if !config.GetBool("enableRouter", true) {
if !config.GetBoolVar(true, "enableRouter") {
enabledRouter = "FALSE"
}
backendConfigMode := "API"
if config.GetBool("BackendConfig.configFromFile", false) {
if config.GetBoolVar(false, "BackendConfig.configFromFile") {
backendConfigMode = "JSON"
}

appTypeStr := strings.ToUpper(config.GetString("APP_TYPE", EMBEDDED))
appTypeStr := strings.ToUpper(config.GetStringVar(EMBEDDED, "APP_TYPE"))
return healthy, fmt.Sprintf(
`{"appType":"%s","server":"UP","db":"%s","acceptingEvents":"TRUE","routingEvents":"%s","mode":"NORMAL",`+
`"backendConfigMode":"%s","lastSync":"%s","lastRegulationSync":"%s"}`,
Expand Down
18 changes: 9 additions & 9 deletions app/apphandlers/embeddedAppHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ func (a *embeddedApp) StartRudderCore(ctx context.Context, shutdownFn func(), op
}

transformerFeaturesService := transformer.NewFeaturesService(ctx, config, transformer.FeaturesServiceOptions{
PollInterval: config.GetDuration("Transformer.pollInterval", 10, time.Second),
TransformerURL: config.GetString("DEST_TRANSFORM_URL", "http://localhost:9090"),
PollInterval: config.GetDurationVar(10, time.Second, "Transformer.pollInterval"),
TransformerURL: config.GetStringVar("http://localhost:9090", "DEST_TRANSFORM_URL"),
FeaturesRetryMaxAttempts: 10,
})

Expand Down Expand Up @@ -197,7 +197,7 @@ func (a *embeddedApp) StartRudderCore(ctx context.Context, shutdownFn func(), op
gwROHandle := jobsdb.NewForRead(
"gw",
jobsdb.WithDSLimit(a.config.gwDSLimit),
jobsdb.WithSkipMaintenanceErr(config.GetBool("Gateway.jobsDB.skipMaintenanceError", true)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(true, "Gateway.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithDBHandle(jobsdbPool),
jobsdb.WithPriorityPoolDB(priorityPool),
Expand All @@ -210,7 +210,7 @@ func (a *embeddedApp) StartRudderCore(ctx context.Context, shutdownFn func(), op
"rt",
jobsdb.WithClearDB(options.ClearDB),
jobsdb.WithDSLimit(a.config.rtDSLimit),
jobsdb.WithSkipMaintenanceErr(config.GetBool("Router.jobsDB.skipMaintenanceError", false)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(false, "Router.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithDBHandle(jobsdbPool),
jobsdb.WithPriorityPoolDB(priorityPool),
Expand All @@ -223,7 +223,7 @@ func (a *embeddedApp) StartRudderCore(ctx context.Context, shutdownFn func(), op
"batch_rt",
jobsdb.WithClearDB(options.ClearDB),
jobsdb.WithDSLimit(a.config.batchrtDSLimit),
jobsdb.WithSkipMaintenanceErr(config.GetBool("BatchRouter.jobsDB.skipMaintenanceError", false)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(false, "BatchRouter.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithDBHandle(jobsdbPool),
jobsdb.WithPriorityPoolDB(priorityPool),
Expand All @@ -236,7 +236,7 @@ func (a *embeddedApp) StartRudderCore(ctx context.Context, shutdownFn func(), op
"esch",
jobsdb.WithClearDB(options.ClearDB),
jobsdb.WithDSLimit(a.config.eschDSLimit),
jobsdb.WithSkipMaintenanceErr(config.GetBool("Processor.jobsDB.skipMaintenanceError", false)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(false, "Processor.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithDBHandle(jobsdbPool),
)
Expand All @@ -246,15 +246,15 @@ func (a *embeddedApp) StartRudderCore(ctx context.Context, shutdownFn func(), op
"arc",
jobsdb.WithClearDB(options.ClearDB),
jobsdb.WithDSLimit(a.config.arcDSLimit),
jobsdb.WithSkipMaintenanceErr(config.GetBool("Processor.jobsDB.skipMaintenanceError", false)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(false, "Processor.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithJobMaxAge(config.GetReloadableDurationVar(24, time.Hour, "archival.jobRetention")),
jobsdb.WithDBHandle(jobsdbPool),
)
defer arcRWDB.Close()

var schemaForwarder schema_forwarder.Forwarder
if config.GetBool("EventSchemas2.enabled", false) {
if config.GetBoolVar(false, "EventSchemas2.enabled") {
client, err := pulsar.NewClient(config)
if err != nil {
return err
Expand Down Expand Up @@ -428,7 +428,7 @@ func (a *embeddedApp) StartRudderCore(ctx context.Context, shutdownFn func(), op
return nil
})

if config.GetBool("JobsDB.Bench.enabled", false) {
if config.GetBoolVar(false, "JobsDB.Bench.enabled") {
g.Go(func() error {
b, err := bench.New(config, statsFactory, a.log.Child("jobsdb.benchmark"), jobsdbPool)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions app/apphandlers/gatewayAppHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (a *gatewayApp) StartRudderCore(ctx context.Context, _ func(), options *app
gwWOHandle := jobsdb.NewForWrite(
"gw",
jobsdb.WithClearDB(options.ClearDB),
jobsdb.WithSkipMaintenanceErr(config.GetBool("Gateway.jobsDB.skipMaintenanceError", true)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(true, "Gateway.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithDBHandle(jobsdbPool),
jobsdb.WithNumPartitions(partitionCount),
Expand Down Expand Up @@ -137,8 +137,8 @@ func (a *gatewayApp) StartRudderCore(ctx context.Context, _ func(), options *app
return err
}
transformerFeaturesService := transformer.NewFeaturesService(ctx, config, transformer.FeaturesServiceOptions{
PollInterval: config.GetDuration("Transformer.pollInterval", 10, time.Second),
TransformerURL: config.GetString("DEST_TRANSFORM_URL", "http://localhost:9090"),
PollInterval: config.GetDurationVar(10, time.Second, "Transformer.pollInterval"),
TransformerURL: config.GetStringVar("http://localhost:9090", "DEST_TRANSFORM_URL"),
FeaturesRetryMaxAttempts: 10,
})
drainConfigManager, err := drain_config.NewDrainConfigManager(config, a.log.Child("drain-config"), statsFactory)
Expand Down
14 changes: 7 additions & 7 deletions app/apphandlers/processorAppHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ func (a *processorApp) StartRudderCore(ctx context.Context, shutdownFn func(), o
}

transformerFeaturesService := transformer.NewFeaturesService(ctx, config, transformer.FeaturesServiceOptions{
PollInterval: config.GetDuration("Transformer.pollInterval", 10, time.Second),
TransformerURL: config.GetString("DEST_TRANSFORM_URL", "http://localhost:9090"),
PollInterval: config.GetDurationVar(10, time.Second, "Transformer.pollInterval"),
TransformerURL: config.GetStringVar("http://localhost:9090", "DEST_TRANSFORM_URL"),
FeaturesRetryMaxAttempts: 10,
})

Expand Down Expand Up @@ -185,7 +185,7 @@ func (a *processorApp) StartRudderCore(ctx context.Context, shutdownFn func(), o
gwROHandle := jobsdb.NewForRead(
"gw",
jobsdb.WithDSLimit(a.config.gwDSLimit),
jobsdb.WithSkipMaintenanceErr(config.GetBool("Gateway.jobsDB.skipMaintenanceError", true)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(true, "Gateway.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithDBHandle(jobsdbPool),
jobsdb.WithPriorityPoolDB(priorityPool),
Expand All @@ -197,7 +197,7 @@ func (a *processorApp) StartRudderCore(ctx context.Context, shutdownFn func(), o
"rt",
jobsdb.WithClearDB(options.ClearDB),
jobsdb.WithDSLimit(a.config.rtDSLimit),
jobsdb.WithSkipMaintenanceErr(config.GetBool("Router.jobsDB.skipMaintenanceError", false)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(false, "Router.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithDBHandle(jobsdbPool),
jobsdb.WithPriorityPoolDB(priorityPool),
Expand All @@ -210,7 +210,7 @@ func (a *processorApp) StartRudderCore(ctx context.Context, shutdownFn func(), o
"batch_rt",
jobsdb.WithClearDB(options.ClearDB),
jobsdb.WithDSLimit(a.config.batchrtDSLimit),
jobsdb.WithSkipMaintenanceErr(config.GetBool("BatchRouter.jobsDB.skipMaintenanceError", false)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(false, "BatchRouter.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithDBHandle(jobsdbPool),
jobsdb.WithPriorityPoolDB(priorityPool),
Expand All @@ -231,15 +231,15 @@ func (a *processorApp) StartRudderCore(ctx context.Context, shutdownFn func(), o
"arc",
jobsdb.WithClearDB(options.ClearDB),
jobsdb.WithDSLimit(a.config.arcDSLimit),
jobsdb.WithSkipMaintenanceErr(config.GetBool("Processor.jobsDB.skipMaintenanceError", false)),
jobsdb.WithSkipMaintenanceErr(config.GetBoolVar(false, "Processor.jobsDB.skipMaintenanceError")),
jobsdb.WithStats(statsFactory),
jobsdb.WithJobMaxAge(config.GetReloadableDurationVar(24, time.Hour, "archival.jobRetention")),
jobsdb.WithDBHandle(jobsdbPool),
)
defer arcRWDB.Close()

var schemaForwarder schema_forwarder.Forwarder
if config.GetBool("EventSchemas2.enabled", false) {
if config.GetBoolVar(false, "EventSchemas2.enabled") {
client, err := pulsar.NewClient(config)
if err != nil {
return err
Expand Down
22 changes: 11 additions & 11 deletions app/apphandlers/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ func rudderCoreNodeSetup() error {
// NewRsourcesService produces a rsources.JobService through environment configuration (env variables & config file)
func NewRsourcesService(deploymentType deployment.Type, shouldSetupSharedDB bool, stats stats.Stats) (rsources.JobService, error) {
var rsourcesConfig rsources.JobServiceConfig
rsourcesConfig.MaxPoolSize = config.GetInt("Rsources.MaxPoolSize", 3)
rsourcesConfig.MinPoolSize = config.GetInt("Rsources.MinPoolSize", 1)
rsourcesConfig.MaxPoolSize = config.GetIntVar(3, 1, "Rsources.MaxPoolSize")
rsourcesConfig.MinPoolSize = config.GetIntVar(1, 1, "Rsources.MinPoolSize")
rsourcesConfig.LocalConn = misc.GetConnectionString(config.Default, "rsources")
rsourcesConfig.LocalHostname = config.GetString("DB.host", "localhost")
sharedDBConnUrl := config.GetString("SharedDB.dsn", "")
rsourcesConfig.LocalHostname = config.GetStringVar("localhost", "DB.host")
sharedDBConnUrl := config.GetStringVar("", "SharedDB.dsn")
if len(sharedDBConnUrl) != 0 {
var err error
sharedDBConnUrl, err = misc.SetAppNameInDBConnURL(sharedDBConnUrl, "rsources")
Expand All @@ -69,12 +69,12 @@ func NewRsourcesService(deploymentType deployment.Type, shouldSetupSharedDB bool
}
}
rsourcesConfig.SharedConn = sharedDBConnUrl
rsourcesConfig.SkipFailedRecordsCollection = !config.GetBool("Router.failedKeysEnabled", true)
rsourcesConfig.SkipFailedRecordsCollection = !config.GetBoolVar(true, "Router.failedKeysEnabled")

if deploymentType == deployment.MultiTenantType {
// For multitenant deployment type we shall require the existence of a SHARED_DB
// TODO: change default value of Rsources.FailOnMissingSharedDB to true, when shared DB is provisioned
if rsourcesConfig.SharedConn == "" && config.GetBool("Rsources.FailOnMissingSharedDB", false) {
if rsourcesConfig.SharedConn == "" && config.GetBoolVar(false, "Rsources.FailOnMissingSharedDB") {
return nil, fmt.Errorf("deployment type %s requires SharedDB.dsn to be provided", deploymentType)
}
}
Expand All @@ -85,9 +85,9 @@ func NewRsourcesService(deploymentType deployment.Type, shouldSetupSharedDB bool
}

func resolveModeProvider(log logger.Logger, deploymentType deployment.Type) (cluster.ChangeEventProvider, error) {
enableProcessor := config.GetBool("enableProcessor", true)
enableRouter := config.GetBool("enableRouter", true)
forceStaticMode := config.GetBool("forceStaticModeProvider", false)
enableProcessor := config.GetBoolVar(true, "enableProcessor")
enableRouter := config.GetBoolVar(true, "enableRouter")
forceStaticMode := config.GetBoolVar(false, "forceStaticModeProvider")

var modeProvider cluster.ChangeEventProvider

Expand Down Expand Up @@ -141,7 +141,7 @@ func terminalErrorFunction(ctx context.Context, g *errgroup.Group) func(error) {
func setupPipelineEnrichers(conf *config.Config, log logger.Logger, stats stats.Stats) ([]enricher.PipelineEnricher, error) {
var enrichers []enricher.PipelineEnricher

if conf.GetBool("GeoEnrichment.enabled", false) {
if conf.GetBoolVar(false, "GeoEnrichment.enabled") {
log.Infon("Setting up the geolocation pipeline enricher")

geoEnricher, err := enricher.NewGeoEnricher(conf, log, stats)
Expand All @@ -151,7 +151,7 @@ func setupPipelineEnrichers(conf *config.Config, log logger.Logger, stats stats.
enrichers = append(enrichers, geoEnricher)
}

if conf.GetBool("BotEnrichment.enabled", true) {
if conf.GetBoolVar(true, "BotEnrichment.enabled") {
log.Infon("Setting up the bot pipeline enricher")

botEnricher, err := enricher.NewBotEnricher()
Expand Down
4 changes: 2 additions & 2 deletions app/apphandlers/setup_partitionmigration.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func setupProcessorPartitionMigrator(ctx context.Context,
rtRWDB, brtRWDB jobsdb.JobsDB,
etcdClientProvider func() (etcdclient.Client, error),
) (ProcessorPartitionMigratorSetup, error) {
if !config.GetBool("PartitionMigration.enabled", false) {
if !config.GetBoolVar(false, "PartitionMigration.enabled") {
finally := func() {}
if gwWODB == nil {
// caller expects to get reader gw db back if writer is nil
Expand Down Expand Up @@ -272,7 +272,7 @@ func setupGatewayPartitionMigrator(ctx context.Context,
gwWODB jobsdb.JobsDB,
etcdClientProvider func() (etcdclient.Client, error),
) (partitionMigrator PartitionMigrator, gwDB jobsdb.JobsDB, err error) {
if !config.GetBool("PartitionMigration.enabled", false) {
if !config.GetBoolVar(false, "PartitionMigration.enabled") {
return &noOpPartitionMigrator{}, gwWODB, nil
}
partitionCount := config.GetIntVar(0, 1, "JobsDB.partitionCount")
Expand Down
2 changes: 1 addition & 1 deletion app/cluster/state/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type modeAckValue struct {
}

func EnvETCDConfig() *ETCDConfig {
endpoints := strings.Split(config.GetString("ETCD_HOSTS", "127.0.0.1:2379"), `,`)
endpoints := strings.Split(config.GetStringVar("127.0.0.1:2379", "ETCD_HOSTS"), `,`)
releaseName := config.GetReleaseName()
serverIndex := misc.GetInstanceID()
var ackTimeout time.Duration
Expand Down
20 changes: 10 additions & 10 deletions archiver/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,31 @@ func New(

archiveFrom: "gw",
archiveTrigger: func() <-chan time.Time {
return time.After(c.GetDuration("archival.ArchiveSleepDuration", 30, time.Second))
return time.After(c.GetDurationVar(30, time.Second, "archival.ArchiveSleepDuration"))
},
adaptivePayloadLimitFunc: func(i int64) int64 { return i },
}

a.config.enabled = func() bool {
return c.GetBool("archival.Enabled", true)
return c.GetBoolVar(true, "archival.Enabled")
}
a.config.concurrency = c.GetReloadableIntVar(10, 1, "archival.ArchiveConcurrency")
a.config.payloadLimit = func() int64 {
return c.GetInt64("archival.ArchivePayloadSizeLimit", 1*bytesize.GB)
return c.GetInt64Var(1*bytesize.GB, 1, "archival.ArchivePayloadSizeLimit")
}
a.config.jobsdbMaxRetries = func() int {
if c.IsSet("JobsDB.Archiver.MaxRetries") {
return c.GetInt("JobsDB.Archiver.MaxRetries", 3)
return c.GetIntVar(3, 1, "JobsDB.Archiver.MaxRetries")
}
return c.GetInt("JobsDB.MaxRetries", 3)
return c.GetIntVar(3, 1, "JobsDB.MaxRetries")
}
a.config.eventsLimit = func() int {
return c.GetInt("archival.ArchiveEventsLimit", 100000)
return c.GetIntVar(100000, 1, "archival.ArchiveEventsLimit")
}
a.config.instanceID = c.GetString("INSTANCE_ID", "1")
a.config.minWorkerSleep = c.GetDuration("archival.MinWorkerSleep", 1, time.Minute)
a.config.uploadFrequency = c.GetDuration("archival.UploadFrequency", 5, time.Minute)
a.config.customVal = c.GetString("Gateway.CustomVal", "GW")
a.config.instanceID = c.GetStringVar("1", "INSTANCE_ID")
a.config.minWorkerSleep = c.GetDurationVar(1, time.Minute, "archival.MinWorkerSleep")
a.config.uploadFrequency = c.GetDurationVar(5, time.Minute, "archival.UploadFrequency")
a.config.customVal = c.GetStringVar("GW", "Gateway.CustomVal")

for _, opt := range opts {
opt(a)
Expand Down
6 changes: 3 additions & 3 deletions backend-config/backend-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ type backendConfigImpl struct {
}

func loadConfig() {
configBackendURL = config.GetString("CONFIG_BACKEND_URL", "https://api.rudderstack.com")
cpRouterURL = config.GetString("CP_ROUTER_URL", "https://cp-router.rudderlabs.com")
configBackendURL = config.GetStringVar("https://api.rudderstack.com", "CONFIG_BACKEND_URL")
cpRouterURL = config.GetStringVar("https://cp-router.rudderlabs.com", "CP_ROUTER_URL")
pollInterval = config.GetReloadableDurationVar(5, time.Second, "BackendConfig.pollInterval", "BackendConfig.pollIntervalInS")
configJSONPath = config.GetStringVar("/etc/rudderstack/workspaceConfig.json", "BackendConfig.configJSONPath")
configFromFile = config.GetBoolVar(false, "BackendConfig.configFromFile")
Expand Down Expand Up @@ -308,7 +308,7 @@ func newForDeployment(deploymentType deployment.Type, region string, configEnvHa
// Setup backend config
func Setup(configEnvHandler types.ConfigEnvI) (err error) {
deploymentType, err := deployment.GetFromEnv()
region := config.GetString("region", "")
region := config.GetStringVar("", "region")
if err != nil {
return fmt.Errorf("deployment type from env: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion backend-config/internal/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func migrate(db *sql.DB) error {
m := &migrator.Migrator{
Handle: db,
MigrationsTable: "config_cache_migrations",
ShouldForceSetLowerVersion: config.GetBool("SQLMigrator.forceSetLowerVersion", true),
ShouldForceSetLowerVersion: config.GetBoolVar(true, "SQLMigrator.forceSetLowerVersion"),
}

return m.Migrate("config_cache")
Expand Down
8 changes: 4 additions & 4 deletions backend-config/namespace_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,24 @@ func (nc *namespaceConfig) SetUp() (err error) {
if !nc.config.IsSet("WORKSPACE_NAMESPACE") {
return errors.New("workspaceNamespace is not configured")
}
nc.namespace = nc.config.GetString("WORKSPACE_NAMESPACE", "")
nc.namespace = nc.config.GetStringVar("", "WORKSPACE_NAMESPACE")
}
if nc.hostedServiceSecret == "" {
if !nc.config.IsSet("HOSTED_SERVICE_SECRET") {
return errors.New("hostedServiceSecret is not configured")
}
nc.hostedServiceSecret = nc.config.GetString("HOSTED_SERVICE_SECRET", "")
nc.hostedServiceSecret = nc.config.GetStringVar("", "HOSTED_SERVICE_SECRET")
}
if nc.configBackendURL == nil {
configBackendURL := nc.config.GetString("CONFIG_BACKEND_URL", "https://api.rudderstack.com")
configBackendURL := nc.config.GetStringVar("https://api.rudderstack.com", "CONFIG_BACKEND_URL")
nc.configBackendURL, err = url.Parse(configBackendURL)
if err != nil {
return err
}
}
if nc.client == nil {
nc.client = &http.Client{
Timeout: nc.config.GetDuration("HttpClient.backendConfig.timeout", 30, time.Second),
Timeout: nc.config.GetDurationVar(30, time.Second, "HttpClient.backendConfig.timeout"),
}
}
nc.workspacesConfig = make(map[string]ConfigT)
Expand Down
2 changes: 1 addition & 1 deletion backend-config/single_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (wc *singleWorkspaceConfig) makeHTTPRequest(ctx context.Context, url string

defer wc.httpCallsStat.Increment()

client := &http.Client{Timeout: config.GetDuration("HttpClient.backendConfig.timeout", 30, time.Second)}
client := &http.Client{Timeout: config.GetDurationVar(30, time.Second, "HttpClient.backendConfig.timeout")}
resp, err := client.Do(req)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions cmd/devtool/commands/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func Mode(c *cli.Context) error {
return fmt.Errorf("invalid mode: %s", mode)
}

endpoints := strings.Split(config.GetString("ETCD_HOSTS", "127.0.0.1:2379"), `,`)
endpoints := strings.Split(config.GetStringVar("127.0.0.1:2379", "ETCD_HOSTS"), `,`)
etcdClient, err := etcd.New(etcd.Config{
Endpoints: endpoints,
Context: c.Context,
Expand Down Expand Up @@ -100,7 +100,7 @@ func Mode(c *cli.Context) error {
}

func List(c *cli.Context) error {
endpoints := strings.Split(config.GetString("ETCD_HOSTS", "127.0.0.1:2379"), `,`)
endpoints := strings.Split(config.GetStringVar("127.0.0.1:2379", "ETCD_HOSTS"), `,`)
etcdClient, err := etcd.New(etcd.Config{
Endpoints: endpoints,
Context: c.Context,
Expand Down
Loading
Loading