Compare commits
No commits in common. "d93c024a0cefe36fd335dd42671d3f8e8bc1adf1" and "ac2c44252c99829b3870d16857edec663a617da9" have entirely different histories.
d93c024a0c
...
ac2c44252c
3 changed files with 0 additions and 21 deletions
|
@ -32,15 +32,6 @@ func ConnectDB(dbConfig *redis.Options) *redis.Client {
|
||||||
return localDb
|
return localDb
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ping test connection to Redis database
|
|
||||||
func Ping(db *redis.Client) error {
|
|
||||||
status := db.Ping(ctx)
|
|
||||||
if status.String() != "ping: PONG" {
|
|
||||||
return &PingError{}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (config DBConfig) InsertPaste(key string, content string, secret string, ttl time.Duration) {
|
func (config DBConfig) InsertPaste(key string, content string, secret string, ttl time.Duration) {
|
||||||
type dbSchema struct {
|
type dbSchema struct {
|
||||||
content string
|
content string
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package database
|
|
||||||
|
|
||||||
type PingError struct{}
|
|
||||||
|
|
||||||
func (m *PingError) Error() string {
|
|
||||||
return "Connection to redis not work"
|
|
||||||
}
|
|
5
main.go
5
main.go
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
"log"
|
|
||||||
|
|
||||||
"git.gnous.eu/gnouseu/plakken/internal/config"
|
"git.gnous.eu/gnouseu/plakken/internal/config"
|
||||||
"git.gnous.eu/gnouseu/plakken/internal/database"
|
"git.gnous.eu/gnouseu/plakken/internal/database"
|
||||||
|
@ -20,10 +19,6 @@ func main() {
|
||||||
initConfig := config.GetConfig()
|
initConfig := config.GetConfig()
|
||||||
dbConfig := database.InitDB(initConfig.RedisAddress, initConfig.RedisUser, initConfig.RedisPassword, initConfig.RedisDB)
|
dbConfig := database.InitDB(initConfig.RedisAddress, initConfig.RedisUser, initConfig.RedisPassword, initConfig.RedisDB)
|
||||||
db := database.ConnectDB(dbConfig)
|
db := database.ConnectDB(dbConfig)
|
||||||
err := database.Ping(db)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
serverConfig := httpServer.ServerConfig{
|
serverConfig := httpServer.ServerConfig{
|
||||||
HTTPServer: httpServer.Config(initConfig.ListenAddress),
|
HTTPServer: httpServer.Config(initConfig.ListenAddress),
|
||||||
|
|
Loading…
Reference in a new issue