Use absolute paths where possible
bingobot blindly uses the shell's working dir to write logs and read configs. This change introduces the following changes: 1. start.sh now determines the project root's absolute path before reading the token file and starting the app. 2. the config package now determine's the executable's working directory (rather than assuming it's the same as the shell's) before loading configs. It also now exposes this for use in other packages. 3. the logging package now uses config.GetWorkingDir() to determine where to write logs.
This commit is contained in:
parent
ad873ef836
commit
0c64670c33
3 changed files with 23 additions and 5 deletions
|
|
@ -20,7 +20,7 @@ func Init() {
|
|||
cfg := config.Get()
|
||||
|
||||
lj := &lumberjack.Logger{
|
||||
Filename: filepath.Join(cfg.LogDir, cfg.LogFile),
|
||||
Filename: filepath.Join(config.GetWorkingDir(), cfg.LogDir, cfg.LogFile),
|
||||
MaxSize: cfg.LogMaxSizeMB,
|
||||
MaxBackups: cfg.LogMaxBackups,
|
||||
MaxAge: cfg.LogMaxAgeDays,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue