Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TIDEPOOL_STORE_APP_NAME environment variable to be used in mongodb #746

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions store/structured/mongo/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Config struct {
Password *string `json:"-" envconfig:"TIDEPOOL_STORE_PASSWORD"`
Timeout time.Duration `json:"timeout" envconfig:"TIDEPOOL_STORE_TIMEOUT" default:"60s"`
OptParams *string `json:"optParams" envconfig:"TIDEPOOL_STORE_OPT_PARAMS"`
AppName *string `json:"appName" envconfig:"TIDEPOOL_STORE_APP_NAME"`
}

// AsConnectionString constructs a MongoDB connection string from a Config
Expand Down Expand Up @@ -67,6 +68,9 @@ func (c *Config) AsConnectionString() string {
if c.OptParams != nil && *c.OptParams != "" {
connectionString += fmt.Sprintf("&%s", *c.OptParams)
}
if c.AppName != nil && *c.AppName != "" {
connectionString += fmt.Sprintf("&appName=%s", url.QueryEscape(*c.AppName))
}

return connectionString
}
Expand Down