Comment fixes

This commit is contained in:
gmemstr 2017-09-11 12:12:24 -07:00
parent 102b4211b0
commit 69a121aefa
4 changed files with 14 additions and 8 deletions

View file

@ -2,10 +2,10 @@
"AdminUsername": "", "AdminUsername": "",
"AdminPassword": "", "AdminPassword": "",
"MediaDirectory": "podcasts/", "MediaDirectory": "podcasts/",
"Name": "Git Galaxy Stargazers", "Name": "Git Galaxy Podcast",
"Host": "Gabriel Simmer", "Host": "Gabriel Simmer",
"Email": "gabriel@gitgalaxy.com", "Email": "gabriel@gitgalaxy.com",
"Description": "open source discussion", "Description": "Discussion about open source projects on the internet.",
"Image": "localhost:8000/assets/podcast_image.png", "Image": "localhost:8000/assets/podcast_image.png",
"PodcastUrl": "http://localhost:8000" "PodcastUrl": "http://localhost:8000"
} }

View file

@ -2,7 +2,7 @@
* *
* Here is where all the neccesary functions for managing episodes * Here is where all the neccesary functions for managing episodes
* live, e.g adding removing etc. * live, e.g adding removing etc.
*/ */
package main package main
@ -13,8 +13,9 @@ import (
"io/ioutil" "io/ioutil"
"io" "io"
"os" // ioOS? "os" // ioOS?
)
"github.com/spf13/viper"
)
// Write custom CSS to disk or send it back to the client if GET // Write custom CSS to disk or send it back to the client if GET
func CustomCss(w http.ResponseWriter, r *http.Request) { func CustomCss(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" { if r.Method == "POST" {

View file

@ -3,7 +3,7 @@
* This file contains functions for monitoring for file changes and * This file contains functions for monitoring for file changes and
* regenerating the RSS feed accordingly, pulling in shownote files * regenerating the RSS feed accordingly, pulling in shownote files
* and configuration parameters * and configuration parameters
*/ */
package main package main
@ -21,6 +21,12 @@ import (
// Watch folder for changes, called from webserver.go // Watch folder for changes, called from webserver.go
func watch() { func watch() {
viper.SetConfigName("config")
viper.AddConfigPath(".")
err := viper.ReadInConfig() // Find and read the config file
if err != nil { // Handle errors reading the config file
panic(fmt.Errorf("Fatal error config file: %s \n", err))
}
watcher, err := fsnotify.NewWatcher() watcher, err := fsnotify.NewWatcher()
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)

View file

@ -2,7 +2,7 @@
* *
* This is the webserver handler for Pogo, and handles * This is the webserver handler for Pogo, and handles
* all incoming connections, including authentication. * all incoming connections, including authentication.
*/ */
package main package main
@ -59,7 +59,7 @@ func HomeHandler(w http.ResponseWriter, r *http.Request) {
/* /*
* Code from stackoverflow by user Timmmm * Code from stackoverflow by user Timmmm
* https://stackoverflow.com/questions/21936332/idiomatic-way-of-requiring-http-basic-auth-in-go/39591234#39591234 * https://stackoverflow.com/questions/21936332/idiomatic-way-of-requiring-http-basic-auth-in-go/39591234#39591234
*/ */
func BasicAuth(handler http.HandlerFunc,) http.HandlerFunc { func BasicAuth(handler http.HandlerFunc,) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
@ -74,7 +74,6 @@ func BasicAuth(handler http.HandlerFunc,) http.HandlerFunc {
w.Write([]byte("Unauthorised.\n")) w.Write([]byte("Unauthorised.\n"))
return return
} }
handler(w, r) handler(w, r)
} }
} }