Update docker-compose_dev, README and add auth basic
This commit is contained in:
@@ -2,6 +2,15 @@
|
||||
|
||||
Website: [https://deizisauer-waschweiber.de/](https://deizisauer-waschweiber.de/)
|
||||
|
||||
## Setting up a development environment
|
||||
* Install docker and docker-compose
|
||||
* Run the docker-compose development file
|
||||
```shell script
|
||||
sudo docker-compose -f docker-compose_dev.yml up -d
|
||||
```
|
||||
This will start pgadmin on port `8084` and a postgres-db on port `8081`
|
||||
* Run the program `trikotwaschliste` to execute the database migrations.
|
||||
|
||||
## Building
|
||||
|
||||
```sh
|
||||
|
@@ -6,7 +6,6 @@ services:
|
||||
environment:
|
||||
PGADMIN_DEFAULT_EMAIL: test@schoff.it
|
||||
PGADMIN_DEFAULT_PASSWORD: example
|
||||
restart: always
|
||||
ports:
|
||||
- "8084:80"
|
||||
volumes:
|
||||
@@ -48,7 +47,6 @@ services:
|
||||
|
||||
postgres-db:
|
||||
image: postgres:11.6
|
||||
restart: always
|
||||
ports:
|
||||
- "8081:5432"
|
||||
environment:
|
||||
|
4
main.go
4
main.go
@@ -14,8 +14,6 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hallo")
|
||||
|
||||
//gin.SetMode(gin.ReleaseMode)
|
||||
r := gin.Default()
|
||||
var err error
|
||||
@@ -33,7 +31,7 @@ func main() {
|
||||
r.Static("/static", "html/static")
|
||||
//r.StaticFile("/favicon.ico", "html/favicon.ico")
|
||||
//routes.RoutesInit(r, pool)
|
||||
routes.RoutesInit(r, pool)
|
||||
routes.RoutesInit(r, pool, &cfg)
|
||||
|
||||
err = r.Run("0.0.0.0:8082")
|
||||
|
||||
|
@@ -12,4 +12,7 @@ type Config struct {
|
||||
DB_DATABASE string `env:"DB_DATABASE" envDefault:"web"`
|
||||
DB_MAXCONNECTIONS uint `env:"DB_MAXCONNECTIONS" envDefault:"5"`
|
||||
|
||||
ADMIN_NAME string `env:"ADMIN_NAME" envDefault:"test"`
|
||||
ADMIN_PASSWORD string `env:"ADMIN_PASSWORD" envDefault:"example"`
|
||||
|
||||
}
|
||||
|
@@ -4,12 +4,21 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"trikotwaschliste/handler"
|
||||
"trikotwaschliste/models"
|
||||
)
|
||||
|
||||
func RoutesInit(router *gin.Engine, pool *pgxpool.Pool) {
|
||||
func RoutesInit(router *gin.Engine, pool *pgxpool.Pool, config *models.Config) {
|
||||
router.GET("/", handler.MainPage(pool))
|
||||
router.GET("/credits", handler.Credits())
|
||||
router.POST("/uploadname", handler.UploadName(pool))
|
||||
|
||||
router.GET("/persons", handler.ShowPersonsList(pool))
|
||||
|
||||
// Basic auth accounts
|
||||
//authorized := router.Group("/admin", gin.BasicAuth(gin.Accounts{
|
||||
//}))
|
||||
|
||||
// Basic auth routes
|
||||
|
||||
|
||||
}
|
||||
|
@@ -4,3 +4,6 @@ DB_USER=web
|
||||
DB_PASSWORD=example
|
||||
DB_DATABASE=web
|
||||
DB_MAXCONNECTIONS=5
|
||||
|
||||
ADMIN_NAME=test
|
||||
ADMIN_PASSWORD=example
|
Reference in New Issue
Block a user