✨ Support services aliasing
This commit is contained in:
parent
63ea5e848f
commit
5dbe1cf80d
@ -1,6 +1,7 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/spf13/viper"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.solsynth.dev/hydrogen/dealer/pkg/internal/directory"
|
"git.solsynth.dev/hydrogen/dealer/pkg/internal/directory"
|
||||||
@ -25,6 +26,11 @@ func listExistsService(c *fiber.Ctx) error {
|
|||||||
func forwardServiceRequest(c *fiber.Ctx) error {
|
func forwardServiceRequest(c *fiber.Ctx) error {
|
||||||
serviceType := c.Params("service")
|
serviceType := c.Params("service")
|
||||||
|
|
||||||
|
aliasingMap := viper.GetStringMapString("services.alias")
|
||||||
|
if val, ok := aliasingMap[serviceType]; ok {
|
||||||
|
serviceType = val
|
||||||
|
}
|
||||||
|
|
||||||
service := directory.GetServiceInstanceByType(serviceType)
|
service := directory.GetServiceInstanceByType(serviceType)
|
||||||
|
|
||||||
if service == nil || service.HttpAddr == nil {
|
if service == nil || service.HttpAddr == nil {
|
||||||
|
@ -36,3 +36,6 @@ cookie_samesite = "Lax"
|
|||||||
access_token_duration = 300
|
access_token_duration = 300
|
||||||
refresh_token_duration = 2592000
|
refresh_token_duration = 2592000
|
||||||
|
|
||||||
|
[services]
|
||||||
|
alias = { id = "auth", uc = "files", co = "interactive", im = "messagings" }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user