Require that .hoster.yml is located in the users home dir.

This commit is contained in:
trading_peter 2024-09-11 11:18:01 +02:00
parent e7ed0407a3
commit eb0141f3bc

View File

@ -4,18 +4,24 @@ import (
"hoster/cmd/hoster_cli/commands" "hoster/cmd/hoster_cli/commands"
"hoster/internals/conf" "hoster/internals/conf"
"os" "os"
"path/filepath"
"github.com/kataras/golog" "github.com/kataras/golog"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
func main() { func main() {
conf.LoadConfig(".hoster.yml") homeDir, err := os.UserHomeDir()
if err != nil {
golog.Fatalf("Error getting home directory: %v", err)
}
conf.LoadConfig(filepath.Join(homeDir, ".hoster.yml"))
app := &cli.App{ app := &cli.App{
Name: "hoster", Name: "hoster",
Usage: "Hoster", Usage: "Hoster",
Version: "1.0.1", Version: "1.0.2",
Commands: []*cli.Command{ Commands: []*cli.Command{
{ {
Name: "new", Name: "new",