Refactor progress

- move directory structure
- string based rule definition
- use traefik rule parsing
- drop toml config
- new flag library
- implement go dep
This commit is contained in:
Thom Seddon
2019-04-12 16:12:13 +01:00
parent d51b93d4b0
commit 9abe509f66
18 changed files with 547 additions and 464 deletions

30
cmd/main.go Normal file
View File

@ -0,0 +1,30 @@
package main
import (
"net/http"
internal "github.com/thomseddon/traefik-forward-auth/internal"
)
// Main
func main() {
// Parse options
config := internal.NewGlobalConfig()
// Setup logger
log := internal.NewDefaultLogger()
// Perform config checks
config.Checks()
// Build server
server := internal.NewServer()
// Attach router to default server
http.HandleFunc("/", server.RootHandler)
// Start
log.Debugf("Starting with options: %s", config.Serialise())
log.Info("Listening on :4181")
log.Info(http.ListenAndServe(":4181", nil))
}

13
cmd/main_test.go Normal file
View File

@ -0,0 +1,13 @@
package main
// import (
// "testing"
// )
/**
* Tests
*/
// func TestMain(t *testing.T) {
// }