mirror of
https://github.com/MizuchiLabs/mantrae.git
synced 2025-12-16 20:05:17 -06:00
slugify profile name
This commit is contained in:
@@ -5,13 +5,12 @@ services:
|
||||
image: ghcr.io/mizuchilabs/mantrae:latest
|
||||
container_name: mantrae
|
||||
environment:
|
||||
- TRAEFIK_URL=https://traefik.example.com # either use the traefik url or the traefik container name if insecure
|
||||
- ADMIN_PASSWORD=<super secret password>
|
||||
- SECRET=<secret> # generate a secret with openssl rand -hex 32
|
||||
- SECRET=<secret> # generate a secret with openssl rand -base64 32
|
||||
volumes:
|
||||
- ./mantrae:/data # base directory used
|
||||
ports:
|
||||
- 3000:3000 # remove this if you want to use traefik
|
||||
- 3000:3000 # remove this if you want to use traefik
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.mantrae.rule=Host(`mantrae.example.com`)
|
||||
@@ -24,9 +23,9 @@ services:
|
||||
container_name: mantrae-agent
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock # needed if running as container
|
||||
- ./agent:/data # persistent data directory for the token
|
||||
environment:
|
||||
- TOKEN=<token> # initial token from mantrae server
|
||||
- HOST=https://mantrae.example.com # where to reach mantrae server
|
||||
restart: unless-stopped
|
||||
|
||||
traefik:
|
||||
@@ -57,7 +56,7 @@ services:
|
||||
- --providers.docker=true
|
||||
- --providers.docker.exposedByDefault=false
|
||||
- --providers.docker.watch=true
|
||||
- --providers.http.endpoint=http://mantrae:3000/api/<profile-name> # use the correct profile name
|
||||
- --providers.http.endpoint=http://mantrae:3000/api/<profile-name>?token=<token> # use the correct profile name
|
||||
- --certificatesresolvers.letsencrypt.acme.email=your@email.com
|
||||
- --certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/acme.json
|
||||
- --certificatesresolvers.letsencrypt.acme.dnschallenge.provider=cloudflare
|
||||
|
||||
6
go.mod
6
go.mod
@@ -20,6 +20,7 @@ require (
|
||||
github.com/domodwyer/mailyak/v3 v3.6.2
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/gosimple/slug v1.15.0
|
||||
github.com/hypersequent/zen v0.0.0-20250722075626-67d8f7873a72
|
||||
github.com/joeig/go-powerdns/v3 v3.16.0
|
||||
github.com/pressly/goose/v3 v3.24.3
|
||||
@@ -87,6 +88,7 @@ require (
|
||||
github.com/google/go-github/v28 v28.1.1 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/gosimple/unidecode v1.0.1 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
|
||||
github.com/hashicorp/go-version v1.7.0 // indirect
|
||||
github.com/http-wasm/http-wasm-host-go v0.7.0 // indirect
|
||||
@@ -138,8 +140,8 @@ require (
|
||||
golang.org/x/text v0.27.0 // indirect
|
||||
golang.org/x/time v0.12.0 // indirect
|
||||
golang.org/x/tools v0.35.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
|
||||
google.golang.org/grpc v1.74.2 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
|
||||
8
go.sum
8
go.sum
@@ -154,6 +154,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||
github.com/gosimple/slug v1.15.0 h1:wRZHsRrRcs6b0XnxMUBM6WK1U1Vg5B0R7VkIf1Xzobo=
|
||||
github.com/gosimple/slug v1.15.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ=
|
||||
github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6T/o=
|
||||
github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90=
|
||||
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
|
||||
@@ -368,8 +372,12 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 h1:0UOBWO4dC+e51ui0NFKSPbkHHiQ4TmrEfEZMLDyRmY8=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0/go.mod h1:8ytArBbtOy2xfht+y2fqKd5DRDJRUQhqbyEnQ4bDChs=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b h1:ULiyYQ0FdsJhwwZUwbaXpZF5yUE3h+RA+gxvBu37ucc=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:oDOGiMSXHL4sDTJvFvIB9nRQCGdLP1o/iVaqQK8zB+M=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 h1:MAKi5q709QWfnkkpNQ0M12hYJ1+e8qYVDyowc4U1XZM=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b h1:zPKJod4w6F1+nRGDI9ubnXYhU9NSWoFAijkHkUXeTK8=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||
google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4=
|
||||
google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"connectrpc.com/connect"
|
||||
|
||||
"github.com/gosimple/slug"
|
||||
"github.com/mizuchilabs/mantrae/pkg/util"
|
||||
mantraev1 "github.com/mizuchilabs/mantrae/proto/gen/mantrae/v1"
|
||||
"github.com/mizuchilabs/mantrae/server/internal/config"
|
||||
@@ -37,7 +38,7 @@ func (s *ProfileService) CreateProfile(
|
||||
req *connect.Request[mantraev1.CreateProfileRequest],
|
||||
) (*connect.Response[mantraev1.CreateProfileResponse], error) {
|
||||
params := db.CreateProfileParams{
|
||||
Name: req.Msg.Name,
|
||||
Name: slug.Make(req.Msg.Name),
|
||||
Description: req.Msg.Description,
|
||||
Token: util.GenerateToken(6),
|
||||
}
|
||||
@@ -64,7 +65,7 @@ func (s *ProfileService) UpdateProfile(
|
||||
) (*connect.Response[mantraev1.UpdateProfileResponse], error) {
|
||||
params := db.UpdateProfileParams{
|
||||
ID: req.Msg.Id,
|
||||
Name: req.Msg.Name,
|
||||
Name: slug.Make(req.Msg.Name),
|
||||
Description: req.Msg.Description,
|
||||
}
|
||||
if req.Msg.GetRegenerateToken() {
|
||||
|
||||
Reference in New Issue
Block a user