From 719ab6c074c1104a2a8e165486dbbd236ca49e11 Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Mon, 16 Jan 2017 13:26:32 -0500 Subject: Allow a default repositoriy to be set in 'config.yml' Minor changes to build script. --- Build.sh | 18 +++++++++--------- config-example.yml | 7 +++++++ config/config.go | 1 + steam-export-cli.go | 10 ++++++++++ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Build.sh b/Build.sh index 14c3a03..8a31e2c 100755 --- a/Build.sh +++ b/Build.sh @@ -7,16 +7,16 @@ fi go build -o bin/steam-export . -GOOS=windows -GOARCH="386" -go build -o bin/steam-export-$GOOS-$GOARCH . - -GOOS=windows -GOARCH=amd64 +export GOOS=windows +export GOARCH="386" go build -o bin/steam-export-$GOOS-$GOARCH.exe . -GOOS=linux -GOARCH=amd64 +export GOOS=windows +export GOARCH=amd64 go build -o bin/steam-export-$GOOS-$GOARCH.exe . -cp bin/steam-export-windows-amd64.exe /Fishtank/Mitch/SteamDrive/SteamGames/ +export GOOS=linux +export GOARCH=amd64 +go build -o bin/steam-export-$GOOS-$GOARCH . + +cp bin/* /Fishtank/Mitch/SteamDrive/scripts/ diff --git a/config-example.yml b/config-example.yml index 6f2837d..01e24e8 100644 --- a/config-example.yml +++ b/config-example.yml @@ -1,7 +1,14 @@ --- listen: 0.0.0.0:9413 +# Repositories that you want to expose on the web server SteamRepositories: # We're ideally looking for the full path to the steamapps folder # On windows you're going to escape the slashes - "C:\\Program Files (x86)\\Steam\\steamapps" # - "/usr/mitch/SteamGames/steamapps" +# optional + +# This defaults to: +# "C:\\Program Files (x86)\\Steam\\steamapps" +#if not set. This doesn't have to be listed in the repository list above +DefaultRepository: "/usr/mitch/SteamGames/steamapps" diff --git a/config/config.go b/config/config.go index 5debdb6..19a79c4 100644 --- a/config/config.go +++ b/config/config.go @@ -12,6 +12,7 @@ var ( type Config struct { SteamRepositories []string `yaml:"SteamRepositories"` + DefaultRepository string `yaml:"DefaultRepository"` Listen string } diff --git a/steam-export-cli.go b/steam-export-cli.go index 30afe83..5f5a0ca 100644 --- a/steam-export-cli.go +++ b/steam-export-cli.go @@ -6,6 +6,7 @@ import ( "fmt" "os" + "git.riedstra.us/mitch/steam-export/config" "git.riedstra.us/mitch/steam-export/steam" ) @@ -156,6 +157,15 @@ func deleteGame(args []string) error { } func main() { + config, err := config.LoadConfig() + if err != nil { + fmt.Println(err) + } else { + if config.DefaultRepository != "" { + defaultLib = config.DefaultRepository + } + } + if err := parseArgs(os.Args); err != nil { fmt.Fprintln(os.Stderr, err) printHelp() -- cgit v1.2.3