You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fxorm/README.md
+21-24Lines changed: 21 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,12 +59,12 @@ type Model struct {
59
59
60
60
funcmain() {
61
61
fx.New(
62
-
fxconfig.FxConfigModule, // load the module dependencies
62
+
fxconfig.FxConfigModule, // load the module dependencies
63
63
fxlog.FxLogModule,
64
64
fxtrace.FxTraceModule,
65
-
fxorm.FxOrmModule, // load the module
66
-
fx.Invoke(func(db *gorm.DB) { // invoke the orm
67
-
db.Create(&Model{Name: "some name"})
65
+
fxorm.FxOrmModule, // load the module
66
+
fx.Invoke(func(gormDB *gorm.DB) { // invoke the orm
67
+
gormDB.Create(&Model{Name: "some name"})
68
68
}),
69
69
).Run()
70
70
}
@@ -91,7 +91,7 @@ app:
91
91
modules:
92
92
orm:
93
93
driver: mysql # driver to use
94
-
dsn: "user:pass@tcp(dbhost:3306)/dbname?parseTime=True"# database DSN to connect to
94
+
dsn: "user:password@tcp(localhost:3306)/db?parseTime=True"# database DSN to use
95
95
config:
96
96
dry_run: false # disabled by default
97
97
skip_default_transaction: false # disabled by default
@@ -113,7 +113,17 @@ modules:
113
113
values: true # by adding or not clear SQL queries parameters values in trace spans, disabled by default
114
114
```
115
115
116
-
See [GORM Config](https://github.com/go-gorm/gorm/blob/master/gorm.go) for more details about the configuration.
116
+
See [GORM Config](https://github.com/go-gorm/gorm/blob/master/gorm.go) for more details about the `modules.orm.config` configuration keys.
117
+
118
+
For security reasons, you should avoid to hardcode DSN sensible parts (like the password) in your config files, you can use the [env vars placeholders](https://github.com/ankorstore/yokai/tree/main/fxconfig#configuration-env-var-placeholders) instead:
0 commit comments