mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 08:53:05 +00:00
Added missing cmd
This commit is contained in:
parent
7198c8bd77
commit
8187085e39
2 changed files with 37 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -15,5 +15,5 @@
|
|||
# vendor/
|
||||
|
||||
config.json
|
||||
headscale
|
||||
./headscale
|
||||
*.key
|
||||
|
|
36
cmd/headscale/headscale.go
Normal file
36
cmd/headscale/headscale.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/juanfont/headscale"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func main() {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath(".")
|
||||
viper.AutomaticEnv()
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Fatalf("Fatal error config file: %s \n", err)
|
||||
}
|
||||
|
||||
cfg := headscale.Config{
|
||||
ServerURL: viper.GetString("server_url"),
|
||||
Addr: viper.GetString("listen_addr"),
|
||||
PrivateKeyPath: viper.GetString("private_key_path"),
|
||||
|
||||
DBhost: viper.GetString("db_host"),
|
||||
DBport: viper.GetInt("db_port"),
|
||||
DBname: viper.GetString("db_name"),
|
||||
DBuser: viper.GetString("db_user"),
|
||||
DBpass: viper.GetString("db_pass"),
|
||||
}
|
||||
h, err := headscale.NewHeadscale(cfg)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
h.Serve()
|
||||
}
|
Loading…
Reference in a new issue