Skip to content

Commit a949646

Browse files
committed
use AdminRole type instead of just string
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
1 parent 76d1620 commit a949646

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

collector/collector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type Config struct {
5555
User string
5656
Password string
5757
ConnectString string
58-
DbRole string
58+
DbRole dsn.AdminRole
5959
ConfigDir string
6060
ExternalAuth bool
6161
MaxIdleConns int
@@ -402,7 +402,7 @@ func (e *Exporter) connect() error {
402402
// if TNS_ADMIN env var is set, set ConfigDir to that location
403403
P.ConfigDir = e.configDir
404404

405-
switch strings.ToUpper(e.config.DbRole) {
405+
switch e.config.DbRole {
406406
case "SYSDBA":
407407
P.AdminRole = dsn.SysDBA
408408
case "SYSOPER":

main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"time"
1414

1515
"github.com/go-kit/log/level"
16+
"github.com/godror/godror/dsn"
1617
"github.com/prometheus/client_golang/prometheus"
1718
cversion "github.com/prometheus/client_golang/prometheus/collectors/version"
1819
"github.com/prometheus/client_golang/prometheus/promhttp"
@@ -87,9 +88,9 @@ func main() {
8788
User: user,
8889
Password: password,
8990
ConnectString: connectString,
90-
DbRole: dbrole,
91+
DbRole: dsn.AdminRole(dbrole),
9192
ConfigDir: tnsadmin,
92-
ExternalAuth: externalAuth,
93+
ExternalAuth: externalAuth,
9394
MaxOpenConns: *maxOpenConns,
9495
MaxIdleConns: *maxIdleConns,
9596
CustomMetrics: *customMetrics,

0 commit comments

Comments
 (0)