forked from MTSR/mapserver
Add support for custom colors.txt dir (#334)
This commit is contained in:
parent
073647a62a
commit
0fd52738d0
@ -129,6 +129,7 @@ func ParseConfig(filename string) (*Config, error) {
|
||||
Skins: &skins,
|
||||
WorldPath: "./",
|
||||
DataPath: "./",
|
||||
ColorsTxtPath: "./",
|
||||
}
|
||||
|
||||
info, err := os.Stat(filename)
|
||||
|
@ -100,11 +100,11 @@ func Setup(p params.ParamsType, cfg *Config) *App {
|
||||
}
|
||||
|
||||
//load provided colors, if available
|
||||
info, err := os.Stat(filepath.Join(a.Config.DataPath, "colors.txt"))
|
||||
info, err := os.Stat(filepath.Join(a.Config.ColorsTxtPath, "colors.txt"))
|
||||
if info != nil && err == nil {
|
||||
logrus.WithFields(logrus.Fields{"filename": "colors.txt"}).Info("Loading colors from filesystem")
|
||||
|
||||
data, err := os.ReadFile(filepath.Join(a.Config.DataPath, "colors.txt"))
|
||||
data, err := os.ReadFile(filepath.Join(a.Config.ColorsTxtPath, "colors.txt"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ type Config struct {
|
||||
Skins *SkinsConfig `json:"skins"`
|
||||
WorldPath string `json:"worldpath"`
|
||||
DataPath string `json:"datapath"`
|
||||
ColorsTxtPath string `json:colorstxtpath`
|
||||
}
|
||||
|
||||
type MapBlockAccessorConfig struct {
|
||||
|
Loading…
Reference in New Issue
Block a user