Implement connstring handling #247
@ -69,10 +69,6 @@ func (ms *MenuStorageService) SetConn(connStr string) error {
|
|||||||
func (ms *MenuStorageService) getOrCreateDb(ctx context.Context, existingDb db.Db, section string) (db.Db, error) {
|
func (ms *MenuStorageService) getOrCreateDb(ctx context.Context, existingDb db.Db, section string) (db.Db, error) {
|
||||||
var newDb db.Db
|
var newDb db.Db
|
||||||
var err error
|
var err error
|
||||||
// database, ok := ctx.Value("Database").(string)
|
|
||||||
// if !ok {
|
|
||||||
// return nil, fmt.Errorf("failed to select the database")
|
|
||||||
// }
|
|
||||||
|
|
||||||
if existingDb != nil {
|
if existingDb != nil {
|
||||||
return existingDb, nil
|
return existingDb, nil
|
||||||
|
@ -45,10 +45,8 @@ func TestEngine(sessionId string) (engine.Engine, func(), chan bool) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
resourceDir := scriptDir
|
resourceDir := scriptDir
|
||||||
//menuStorageService := storage.NewMenuStorageService(connStr, resourceDir)
|
|
||||||
menuStorageService := storage.NewMenuStorageService(resourceDir)
|
menuStorageService := storage.NewMenuStorageService(resourceDir)
|
||||||
|
|
||||||
//err := menuStorageService.EnsureDbDir()
|
|
||||||
err = menuStorageService.SetConn(connStr)
|
err = menuStorageService.SetConn(connStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "conn error: %v", err)
|
fmt.Fprintf(os.Stderr, "conn error: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user