feat(proxy): Add reverse proxy feature

This commit is contained in:
Björn Benouarets
2026-02-05 23:58:47 +01:00
parent 07474afae9
commit 30adf0c701
20 changed files with 514 additions and 323 deletions

View File

@@ -6,20 +6,20 @@ import (
"go.yaml.in/yaml/v3"
)
type FileConfig struct {
type File struct {
filePath string
config *Configuration
}
func NewFileConfig(filePath string) (*FileConfig, error) {
c := &FileConfig{filePath: filePath, config: &Configuration{}}
func NewFile(filePath string) (*File, error) {
c := &File{filePath: filePath, config: &Configuration{}}
if err := c.loadConfig(); err != nil {
return nil, err
}
return c, nil
}
func (c *FileConfig) loadConfig() error {
func (c *File) loadConfig() error {
data, err := os.ReadFile(c.filePath)
if err != nil {
return err
@@ -27,34 +27,6 @@ func (c *FileConfig) loadConfig() error {
return yaml.Unmarshal(data, c.config)
}
func (c *FileConfig) GetConfiguration() *Configuration {
func (c *File) GetConfiguration() *Configuration {
return c.config
}
func (c *FileConfig) GetGatewayConfiguration() *GatewayConfiguration {
return &c.config.Gateway
}
func (c *FileConfig) GetRoutes() []RouteConfiguration {
return c.config.Routes
}
func (c *FileConfig) GetProxies() []ProxyConfiguration {
return c.config.Proxies
}
func (c *FileConfig) GetHost() string {
return c.config.Gateway.Host
}
func (c *FileConfig) GetPort() int {
return c.config.Gateway.Port
}
func (c *FileConfig) GetApis() []ApiConfiguration {
return c.config.Apis
}
func (c *FileConfig) GetFeatures() []string {
return c.config.Gateway.Features
}