|
|
|
@ -69,12 +69,12 @@ func InitWaDB(ctx context.Context, DBURI string) *sqlstore.Container { |
|
|
|
// initDatabase creates and returns a database store container based on the configured URI
|
|
|
|
func initDatabase(ctx context.Context, dbLog waLog.Logger, DBURI string) (*sqlstore.Container, error) { |
|
|
|
if strings.HasPrefix(config.DBURI, "file:") { |
|
|
|
return sqlstore.New(ctx, "sqlite3", config.DBURI, dbLog) |
|
|
|
} else if strings.HasPrefix(config.DBURI, "postgres:") { |
|
|
|
return sqlstore.New(ctx, "postgres", config.DBURI, dbLog) |
|
|
|
return sqlstore.New(ctx, "sqlite3", DBURI, dbLog) |
|
|
|
} else if strings.HasPrefix(DBURI, "postgres:") { |
|
|
|
return sqlstore.New(ctx, "postgres", DBURI, dbLog) |
|
|
|
} |
|
|
|
|
|
|
|
return nil, fmt.Errorf("unknown database type: %s. Currently only sqlite3(file:) and postgres are supported", config.DBURI) |
|
|
|
return nil, fmt.Errorf("unknown database type: %s. Currently only sqlite3(file:) and postgres are supported", DBURI) |
|
|
|
} |
|
|
|
|
|
|
|
// InitWaCLI initializes the WhatsApp client
|
|
|
|
|