mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 17:35:40 +08:00
conf: support relative path in "rules-dir" config
This commit is contained in:
parent
1a941cd095
commit
419fa05171
4
conf.go
4
conf.go
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
|
|
||||||
"github.com/nadoo/conflag"
|
"github.com/nadoo/conflag"
|
||||||
)
|
)
|
||||||
@ -66,8 +67,9 @@ func confInit() {
|
|||||||
conf.rules = append(conf.rules, rule)
|
conf.rules = append(conf.rules, rule)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: allow to use relative dir to the config file
|
conf.RulesDir = path.Join(flag.ConfDir(), conf.RulesDir)
|
||||||
ruleFolderFiles, _ := listDir(conf.RulesDir, ".rule")
|
ruleFolderFiles, _ := listDir(conf.RulesDir, ".rule")
|
||||||
|
|
||||||
for _, ruleFile := range ruleFolderFiles {
|
for _, ruleFile := range ruleFolderFiles {
|
||||||
rule, err := NewRuleConfFromFile(ruleFile)
|
rule, err := NewRuleConfFromFile(ruleFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user