fixed some stuff
This commit is contained in:
parent
32d64f3637
commit
5f01b6b27c
@ -18,6 +18,10 @@ authentication:
|
||||
client_secret: ""
|
||||
user_pass:
|
||||
type: "mongo"
|
||||
initial_user:
|
||||
username: ""
|
||||
password: ""
|
||||
email: ""
|
||||
mongo:
|
||||
url: "mongodb://mongo:27107"
|
||||
username: ""
|
||||
@ -45,6 +49,10 @@ instancemanager:
|
||||
tag: "latest"
|
||||
command: ""
|
||||
network: "exposed"
|
||||
reverse_proxy:
|
||||
middlewares:
|
||||
- games@docker
|
||||
entrypoint: "web"
|
||||
|
||||
users:
|
||||
default_max_owned_servers: 10
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"maps"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
instancemanager "git.acooldomain.co/server-manager/backend/instancemanager"
|
||||
"git.acooldomain.co/server-manager/backend/models"
|
||||
@ -496,11 +497,13 @@ func (self *InstanceManager) StartFileBrowser(ctx context.Context, serverId stri
|
||||
browserLabels := make(map[string]string)
|
||||
browserLabels["traefik.enable"] = "true"
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.rule", labelId)] = fmt.Sprintf("Host(`%s.browsers.%s`)", labelId, self.config.BrowsersDomain)
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.entrypoints", labelId)] = "websecure"
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.middlewares", labelId)] = "games@docker"
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.tls.domains[0].main", labelId)] = fmt.Sprintf("%s.%s", "browsers", self.config.BrowsersDomain)
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.tls.domains[0].sans", labelId)] = fmt.Sprintf("*.%s.%s", "browsers", self.config.BrowsersDomain)
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.tls.certresolver", labelId)] = "myresolver"
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.entrypoints", labelId)] = self.config.FileBrowser.ReverseProxy.Entrypoint
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.middlewares", labelId)] = strings.Join(self.config.FileBrowser.ReverseProxy.Middlewares, ",")
|
||||
if self.config.FileBrowser.ReverseProxy.Tls {
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.tls.domains[0].main", labelId)] = self.config.BrowsersDomain
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.tls.domains[0].sans", labelId)] = fmt.Sprintf("*.%s", self.config.BrowsersDomain)
|
||||
browserLabels[fmt.Sprintf("traefik.http.routers.%s.tls.certresolver", labelId)] = self.config.FileBrowser.ReverseProxy.TlsResolver
|
||||
}
|
||||
|
||||
containerConfig, err := convertLabelsToMap(ContainerLabels{VolumeId: serverId, Type: FileBrowser})
|
||||
if err != nil {
|
||||
|
@ -50,10 +50,18 @@ type AuthenticationConfig struct {
|
||||
UserPass UserPassAuthConfig `yaml:"user_pass"`
|
||||
}
|
||||
|
||||
type DockerReverseProxyConfig struct {
|
||||
Middlewares []string `yaml:"middlewares"`
|
||||
Entrypoint string `yaml:"entrypoint"`
|
||||
Tls bool `yaml:"tls"`
|
||||
TlsResolver string `yaml:"tls_resolver"`
|
||||
}
|
||||
|
||||
type FileBrowserConfig struct {
|
||||
Image Image `yaml:"image"`
|
||||
Command string `yaml:"command"`
|
||||
Network string `yaml:"network"`
|
||||
Image Image `yaml:"image"`
|
||||
Command string `yaml:"command"`
|
||||
Network string `yaml:"network"`
|
||||
ReverseProxy DockerReverseProxyConfig `yaml:"reverse_proxy"`
|
||||
}
|
||||
|
||||
type DockerInstanceManagerConfig struct {
|
||||
|
@ -51,6 +51,6 @@ func LoadBrowsersGroup(group *gin.RouterGroup, config models.GlobalConfig) {
|
||||
InstanceManager: instanceManager,
|
||||
}
|
||||
|
||||
group.GET("", auth.AuthorizedTo(0), auth.AuthorizationEnforcer(), connection.GetBrowsers)
|
||||
group.GET("", connection.GetBrowsers)
|
||||
group.POST("/:server_id/stop", auth.AuthorizedTo(models.Browse), connection.ServerAuthorized(models.Browse), auth.AuthorizationEnforcer(), connection.StopBrowser)
|
||||
}
|
||||
|
@ -455,6 +455,7 @@ func (con ServersApi) BrowseServer(ctx *gin.Context) {
|
||||
|
||||
if err != nil {
|
||||
ctx.AbortWithError(500, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(200, browserInfo.Url)
|
||||
|
Loading…
x
Reference in New Issue
Block a user