From 3f71d75a99d432a9ed1eedc2ec6cbecf900e7c5c Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 6 Aug 2018 21:30:11 -0500 Subject: [PATCH] Restoring ignored file changes Also deleted a file I missed --- .gitignore | 6 ++--- src/my-prayer-journal.go | 48 ---------------------------------------- 2 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 src/my-prayer-journal.go diff --git a/.gitignore b/.gitignore index 4e63cca..b40b050 100644 --- a/.gitignore +++ b/.gitignore @@ -254,8 +254,8 @@ paket-files/ # Compiled files / application src/api/build -src/public/index.html -src/public/static -src/config.json +src/api/MyPrayerJournal.Api/wwwroot/index.html +src/api/MyPrayerJournal.Api/wwwroot/static +src/api/MyPrayerJournal.Api/appsettings.development.json /build src/*.exe diff --git a/src/my-prayer-journal.go b/src/my-prayer-journal.go deleted file mode 100644 index 04ef79f..0000000 --- a/src/my-prayer-journal.go +++ /dev/null @@ -1,48 +0,0 @@ -// myPrayerJournal API Server -package main - -import ( - "encoding/json" - "log" - "net/http" - "os" - - "github.com/danieljsummers/myPrayerJournal/src/api/data" - "github.com/danieljsummers/myPrayerJournal/src/api/routes" -) - -// Web contains configuration for the web server. -type Web struct { - Port string `json:"port"` -} - -// Settings contains configuration for the myPrayerJournal API. -type Settings struct { - Data *data.Settings `json:"data"` - Web *Web `json:"web"` - Auth *routes.AuthConfig `json:"auth"` -} - -// readSettings parses the JSON configuration file into the Settings struct. -func readSettings(f string) *Settings { - config, err := os.Open(f) - if err != nil { - log.Fatal(err) - } - defer config.Close() - settings := Settings{} - if err = json.NewDecoder(config).Decode(&settings); err != nil { - log.Fatal(err) - } - return &settings -} - -func main() { - cfg := readSettings("config.json") - if ok := data.Connect(cfg.Data); !ok { - log.Fatal("Unable to connect to database; exiting") - } - data.EnsureDB() - log.Printf("myPrayerJournal API listening on %s", cfg.Web.Port) - log.Fatal(http.ListenAndServe(cfg.Web.Port, routes.NewRouter(cfg.Auth))) -}