basic setup, /ping added
This commit is contained in:
21
relay/config.go
Normal file
21
relay/config.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package relay
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
)
|
||||
|
||||
func LoadConfig(path string) (*Config, error) {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open config: %w", err)
|
||||
}
|
||||
|
||||
var cfg Config
|
||||
if err = toml.NewDecoder(file).Decode(&cfg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &cfg, nil
|
||||
}
|
||||
Reference in New Issue
Block a user