mirror of
https://github.com/tiennm99/keepalive.git
synced 2026-10-15 14:16:38 +00:00
feat: remove driver name config
This commit is contained in:
1 parent
40e433e284
commit
e09ddceb37
2 files changed
+1
-8
No files matched your search
@@ -1,2 +1 @@
|
|||||||
DRIVER_NAME=mysql
|
|
||||||
DATA_SOURCE_NAME=keepalive:keepalive@tcp(localhost:3306)/keepalive?tls=custom
|
DATA_SOURCE_NAME=keepalive:keepalive@tcp(localhost:3306)/keepalive?tls=custom
|
||||||
+1
-7
@@ -20,12 +20,6 @@ func main() {
|
|||||||
log.Println("Warning: .env file not found")
|
log.Println("Warning: .env file not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
driverName, isExist := os.LookupEnv("DRIVER_NAME")
|
|
||||||
if !isExist {
|
|
||||||
log.Fatal("Warning: DRIVER_NAME not set!")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
dataSourceName, isExist := os.LookupEnv("DATA_SOURCE_NAME")
|
dataSourceName, isExist := os.LookupEnv("DATA_SOURCE_NAME")
|
||||||
if !isExist {
|
if !isExist {
|
||||||
log.Fatal("Warning: DATA_SOURCE_NAME not set!")
|
log.Fatal("Warning: DATA_SOURCE_NAME not set!")
|
||||||
@@ -46,7 +40,7 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
db, err := sql.Open(driverName, dataSourceName)
|
db, err := sql.Open("mysql", dataSourceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user