diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2024-01-06 16:23:02 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2024-01-06 16:23:02 -0500 |
| commit | 263ce3e4b368a50efee1a53af11a76a12af0a119 (patch) | |
| tree | 8917754f3b43830604f6ad4c7115934ed633f1d8 /internal/storage/dbtest/dbtest.go | |
| parent | Fix syntax (diff) | |
| download | cli-263ce3e4b368a50efee1a53af11a76a12af0a119.zip | |
Break up migration repo into fs and db with a service
Diffstat (limited to 'internal/storage/dbtest/dbtest.go')
| -rw-r--r-- | internal/storage/dbtest/dbtest.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/storage/dbtest/dbtest.go b/internal/storage/dbtest/dbtest.go new file mode 100644 index 0000000..c53c04a --- /dev/null +++ b/internal/storage/dbtest/dbtest.go @@ -0,0 +1,24 @@ +package dbtest + +import ( + "os" + "strconv" + + "github.com/eugenetriguba/bolt/internal/configloader" +) + +func NewTestConnectionConfig(driver string) (*configloader.ConnectionConfig, error) { + port, err := strconv.Atoi(os.Getenv("DB_PORT")) + if err != nil { + return nil, err + } + + return &configloader.ConnectionConfig{ + Driver: driver, + DBName: os.Getenv("DB_NAME"), + Host: os.Getenv("DB_HOST"), + Port: port, + User: os.Getenv("DB_USERNAME"), + Password: os.Getenv("DB_PASSWORD"), + }, nil +} |