resolve symlink

This commit is contained in:
Adphi 2020-11-21 12:36:08 +01:00
parent 9919c261f1
commit af626f35c4
3 changed files with 12 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.idea .idea
config.yml config.yml
config.sm.yaml

View File

@ -18,6 +18,8 @@ spec:
- /config/config.yml - /config/config.yml
image: adphi/go-repo image: adphi/go-repo
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports:
- containerPort: 8888
volumeMounts: volumeMounts:
- mountPath: /config - mountPath: /config
name: config name: config
@ -51,5 +53,6 @@ spec:
selector: selector:
app: go-repo app: go-repo
ports: ports:
- port: 8888 - port: 80
targetPort: 8888
type: LoadBalancer type: LoadBalancer

View File

@ -2,6 +2,7 @@ package main
import ( import (
"net/http" "net/http"
"path/filepath"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -24,7 +25,11 @@ func main() {
if l, err := logrus.ParseLevel(level); err == nil { if l, err := logrus.ParseLevel(level); err == nil {
logrus.SetLevel(l) logrus.SetLevel(l)
} }
mods, err := NewModules(args[0]) path := args[0]
if s, err := filepath.EvalSymlinks(path); err == nil {
path = s
}
mods, err := NewModules(path)
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }
@ -69,7 +74,7 @@ func main() {
} }
} }
}() }()
if err := watcher.Add(args[0]); err != nil { if err := watcher.Add(path); err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }
go func() { go func() {