mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-13 07:29:30 +01:00
chdir instead of relativizing paths in config
This commit is contained in:
parent
6d194e3d94
commit
22c1cfdc3e
@ -10,6 +10,7 @@ import (
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func genPasswd(passwd string) {
|
||||
@ -57,6 +58,10 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = os.Chdir(filepath.Dir(*conf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if *initdb {
|
||||
initDB(config)
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"log"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type PassConfig struct {
|
||||
@ -68,12 +67,5 @@ func LoadConfig(filename string) (config *Config, err error) {
|
||||
err = errors.New("server.listen missing")
|
||||
return
|
||||
}
|
||||
|
||||
// make
|
||||
dir := filepath.Dir(filename)
|
||||
if config.Server.MOTD != "" {
|
||||
config.Server.MOTD = filepath.Join(dir, config.Server.MOTD)
|
||||
}
|
||||
config.Server.Database = filepath.Join(dir, config.Server.Database)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user