Host SSH portals to applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
619 B

package main
import (
"fmt"
"io/ioutil"
"log"
"gopkg.in/yaml.v2"
)
type portalConfig struct {
Command string
Host []string `yaml:",flow"`
}
type appConfig struct {
Portals map[string]*portalConfig
}
var config = &appConfig{}
func readConfig(configPath string) error {
configData, err := ioutil.ReadFile(configPath)
if err != nil {
return fmt.Errorf("failed to read file: %s", err)
}
err = yaml.Unmarshal(configData, config)
if err != nil {
return fmt.Errorf("failed to parse file: %s", err)
}
if len(config.Portals) == 0 {
log.Println("Warning: No portals are defined")
}
return nil
}