mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-05-04 18:07:50 +00:00
wip
This commit is contained in:
parent
75942990ac
commit
3c0ee7e8a3
9 changed files with 192 additions and 70 deletions
cmd
32
cmd/main.go
32
cmd/main.go
|
@ -75,12 +75,34 @@ func Serve(ctx *cli.Context) error {
|
|||
}
|
||||
|
||||
// Init ssl cert database
|
||||
dbPogrebDB := ctx.String("db-pogreb")
|
||||
certDB, err := database.NewPogreb(dbPogrebDB)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create database: %v", err)
|
||||
var certDB database.CertDB
|
||||
if ctx.String("db-type") != "" {
|
||||
log.Trace().Msg("use xorm mode")
|
||||
certDB, err = database.NewXormDB(ctx.String("db-type"), ctx.String("db-conn"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not connect to database: %w", err)
|
||||
}
|
||||
} else {
|
||||
// TODO: remove in next version
|
||||
fmt.Println(`
|
||||
######################
|
||||
## W A R N I N G !!! #
|
||||
######################
|
||||
|
||||
You use "pogreb" witch is deprecated and will be removed in the next version.
|
||||
Please switch to sqlite, mysql or postgres !!!
|
||||
|
||||
The simplest way is, to use './pages certs migrate' and set environment var DB_TYPE to 'sqlite' on next start.
|
||||
|
||||
`)
|
||||
log.Error().Msg("depricated \"pogreb\" used\n")
|
||||
|
||||
certDB, err = database.NewPogreb(ctx.String("db-pogreb"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create database: %w", err)
|
||||
}
|
||||
}
|
||||
defer certDB.Close() //nolint:errcheck // database has no close ... sync behave like it
|
||||
defer certDB.Close()
|
||||
|
||||
keyCache := cache.NewKeyValueCache()
|
||||
challengeCache := cache.NewKeyValueCache()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue