Initial commit

This commit is contained in:
eleksir
2026-03-14 22:51:43 +03:00
commit 0a73bca056
105 changed files with 24685 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
package holy
import (
"fmt"
"os"
"path/filepath"
)
// defaultConfigFileLocations выдаёт варианты путей, по которым может находиться конфиг-файл.
func defaultConfigFileLocations() ([]string, error) {
var locations []string
executablePath, err := os.Executable()
if err != nil {
return locations, fmt.Errorf("Unable to get my executable path: %w", err) //nolint: staticcheck // Looks like golangci-lint ignoring settings about fucking ST1005 check. We want readable errors despite what wants author of linter or assholes from go dev team.
}
configJSONPath := filepath.Dir(executablePath) + "/data/config.json"
locations = []string{
"~/.tg-holy-bot.json",
"/etc/tg-holy-bot.json",
configJSONPath,
}
return locations, nil
}
/* vim: set ft=go noet ai ts=4 sw=4 sts=4: */