INNER CODE UNIT · Go
connectDB
arp242/goatcounter · cmd/goatcounter/main.go:198
func connectDB(connect, dbConn string, migrate []string, create, dev bool) (zdb.DB, context.Context, error) {
if strings.Contains(connect, "://") && !strings.Contains(connect, "+") {
connect = strings.Replace(connect, "://", "+", 1)
log.Warnf(context.Background(), `the connection string for -db changed from "engine://connectString"`+
` to "engine+connectString"; the ://-variant will work for now, but will be removed in a future release`)
}
var open, idle int
if dbConn != "" {
openS, idleS, ok := strings.Cut(dbConn, ",")
if !ok {
return nil, nil, errors.New("-dbconn flag: must be as max_open,max_idle")
}
var err error
open, err = strconv.Atoi(openS)
if err != nil {
return nil, nil, fmt.Errorf("-dbconn flag: %w", err)
}