alpha database connection

Vic
Vic 2 years ago
parent a089a36f3d
commit 900304f9a8

@ -0,0 +1,15 @@
POSTGRES_HOST=127.0.0.1
POSTGRES_DB=shelf
POSTGRES_TEST_DB=shelf_test
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_PORT=5432
ENV=dev
POSTGRES_DRIVER=postgres
POSTGRES_SOURCE=postgresql://postgres:postgres@localhost:5432/shelf?sslmode=disable
BCRYPT_PASSWORD=speak-friend-and-enter
SALT_ROUNDS=10
TOKEN_SECRET=alohomora123!
TOKEN_SECRET_TEST=eyJhbGciOiJIUzI1NiIsInR

@ -1,14 +1,28 @@
package main
import (
"net/http"
//"database/sql"
"database/sql"
"fmt"
"log"
"net/http"
"github.com/gin-gonic/gin"
"git.sp4ke.xyz/AnisB/shelf_api_go/src/branch/Vic/config/default.go"
//_ "github.com/lib/pq"
)
func main() {
config, err := config.LoadConfig(".")
if err != nil {
log.Fatalf("Failed to load config: %v", err)
}
conn, err := sql.Open(config.PostgreDriver, config.PostgreSource)
if err != nil {
log.Fatalf("Failed to connect: %v", err)
}
r := gin.Default()
r.GET("/", func(c *gin.Context) {

Loading…
Cancel
Save