aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2017-01-16 13:26:32 -0500
committerMitch Riedstra <mitch@riedstra.us>2017-01-16 13:26:32 -0500
commit719ab6c074c1104a2a8e165486dbbd236ca49e11 (patch)
tree3ea28824015b1bf9e674cc9222090ca14ef507d6
parentb7f674cb4e752808d16c314b4b3561d1a3a37e1f (diff)
downloadsteam-export-719ab6c074c1104a2a8e165486dbbd236ca49e11.tar.gz
steam-export-719ab6c074c1104a2a8e165486dbbd236ca49e11.tar.xz
Allow a default repositoriy to be set in 'config.yml' Minor changes to build script.
-rwxr-xr-xBuild.sh18
-rw-r--r--config-example.yml7
-rw-r--r--config/config.go1
-rw-r--r--steam-export-cli.go10
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()