mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
internal/router: fix fresh tomato config path
When ctrld performs upgrading tasks, the current binary would be moved to different file, thus the executable will return this new file name, instead of the old "/path/to/ctrld". The config path on FreshTomato is located in the same directory with ctrld binary, with ".startup" suffix. So when the binary was moved during upgrading, the config path is located wrongly. To fix it, read the binary path from service config first, then only fallback to the current executable if the path is empty (this is the same way ctrld is doing for other router platforms).
This commit is contained in:
committed by
Cuong Manh Le
parent
46a1039f21
commit
e578867118
@@ -45,11 +45,15 @@ func (s *tomatoSvc) Platform() string {
|
||||
}
|
||||
|
||||
func (s *tomatoSvc) configPath() string {
|
||||
path, err := os.Executable()
|
||||
if err != nil {
|
||||
return ""
|
||||
bin := s.Config.Executable
|
||||
if bin == "" {
|
||||
path, err := os.Executable()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
bin = path
|
||||
}
|
||||
return path + ".startup"
|
||||
return bin + ".startup"
|
||||
}
|
||||
|
||||
func (s *tomatoSvc) template() *template.Template {
|
||||
|
||||
Reference in New Issue
Block a user