Skip to content

Commit 5af93ce

Browse files
Renamed obsolete PLGM_REPLICA_SET env var PLGM_REPLICASET_NAME
1 parent 6ab4e09 commit 5af93ce

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Environment Variables (Overrides):
9494
PLGM_USERNAME Database User
9595
PLGM_PASSWORD Database Password (Recommended: Use Prompt)
9696
PLGM_DIRECT_CONNECTION Force direct connection (true/false)
97-
PLGM_REPLICA_SET Replica Set name
97+
PLGM_REPLICASET_NAME Replica Set name
9898
PLGM_READ_PREFERENCE nearest
9999

100100
[Workload Core]
@@ -206,7 +206,7 @@ You can override any setting in `config.yaml` using environment variables. This
206206
| **Connection** | | | |
207207
| `uri` | `PLGM_URI` | Target MongoDB connection URI | `mongodb://user:pass@host:27017` |
208208
| `direct_connection` | `PLGM_DIRECT_CONNECTION` | Force direct connection (bypass topology discovery) | `true` |
209-
| `replicaset_name` | `PLGM_REPLICA_SET` | Replica Set name (required for sharded clusters/RS) | `rs0` |
209+
| `replicaset_name` | `PLGM_REPLICASET_NAME` | Replica Set name (required for sharded clusters/RS) | `rs0` |
210210
| `read_preference` | `PLGM_READ_PREFERENCE` | By default, an application directs its read operations to the primary member in a replica set. You can specify a read preference to send read operations to secondaries. | `nearest` |
211211
| `username` | `PLGM_USERNAME` | Database User | `admin` |
212212
| ***can not be set via config*** | `PLGM_PASSWORD` | Database Password (if not set, plgm will prompt) | `password123` |

cmd/plgm/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func main() {
4545
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PLGM_USERNAME", "Database User")
4646
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PLGM_PASSWORD", "Database Password (Recommended: Use Prompt)")
4747
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PLGM_DIRECT_CONNECTION", "Force direct connection (true/false)")
48-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PLGM_REPLICA_SET", "Replica Set name")
48+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PLGM_REPLICASET_NAME", "Replica Set name")
4949
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PLGM_READ_PREFERENCE", "nearest")
5050

5151
fmt.Fprintf(os.Stderr, "\n [Workload Core]\n")

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ connection_params:
1515
username: "root"
1616
auth_source: admin # Database to authenticate against
1717
direct_connection: true # Connect directly to the host (bypass topology discovery if single node)
18-
replicaset_name: rs # Required if connecting to a Replica Set
18+
replicaset_name: rs # Required if connecting to a Replica Set, set to "" if connecting to a sharded cluster
1919
read_preference: primary
2020
connection_timeout: 30 # Time (seconds) to wait for an initial connection
2121
server_selection_timeout: 15 # Time (seconds) to wait to find a suitable server for an op

internal/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ func applyEnvOverrides(cfg *AppConfig) {
120120
}
121121

122122
// 2. Default Workload (Explicit Override)
123-
// If the user sets this Env Var, it takes precedence over everything.
124123
if v := os.Getenv("PLGM_DEFAULT_WORKLOAD"); v != "" {
125124
if b, err := strconv.ParseBool(v); err == nil {
126125
cfg.DefaultWorkload = b
@@ -141,9 +140,11 @@ func applyEnvOverrides(cfg *AppConfig) {
141140
cfg.ConnectionParams.DirectConnection = b
142141
}
143142
}
144-
if v, exists := os.LookupEnv("PLGM_REPLICA_SET"); exists {
143+
144+
if v, exists := os.LookupEnv("PLGM_REPLICASET_NAME"); exists {
145145
cfg.ConnectionParams.ReplicaSetName = v
146146
}
147+
147148
if v, exists := os.LookupEnv("PLGM_READ_PREFERENCE"); exists {
148149
cfg.ConnectionParams.ReadPreference = v
149150
}
@@ -268,7 +269,6 @@ func applyEnvOverrides(cfg *AppConfig) {
268269
}
269270

270271
func normalizePercentages(cfg *AppConfig) {
271-
// If transactions are disabled, ignore their percentage entirely
272272
if !cfg.UseTransactions {
273273
cfg.TransactionPercent = 0
274274
}

0 commit comments

Comments
 (0)