-
Notifications
You must be signed in to change notification settings - Fork 12
/
green-proxy.go
33 lines (28 loc) · 882 Bytes
/
green-proxy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"fmt"
"greenproxy/config"
"greenproxy/proxy"
)
// Main function
func main() {
// Load config using config package
fmt.Println("[Config] Loading config file...")
config := config.GetConfig("config/config.yaml")
// Print loaded config
fmt.Println("\n[Config] Proxy config:")
fmt.Println("[Config] - Port:", config.Webserver.Port)
fmt.Println("[Config] - Hostname:", config.Webserver.Hostname)
fmt.Println("[Config] - Proxy route:", config.Webserver.ProxyUrl)
fmt.Println("[Config] - API endpoint:", config.Endpoints.Api)
fmt.Println()
// Start proxy service
err := proxy.StartProxy(config.Webserver.Hostname, config.Webserver.Port, proxy.Proxy{
ProxyRoute: config.Webserver.ProxyUrl,
ApiEndpoint: config.Endpoints.Api,
})
// Check if started successfully
if err != nil {
fmt.Println("Error while starting proxy service:", err)
}
}