Cleanups for Dockerization
This commit is contained in:
parent
6b8235c36b
commit
7617f47ba0
6
Dockerfile
Normal file
6
Dockerfile
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
FROM alpine
|
||||||
|
EXPOSE 80
|
||||||
|
RUN ["mkdir", "/data"]
|
||||||
|
WORKDIR /data
|
||||||
|
COPY track-me /app/
|
||||||
|
ENTRYPOINT ["/app/track-me"]
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"p83.nl/go/indieauth"
|
"p83.nl/go/indieauth"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ func (h *IndieAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Println(authURL)
|
log.Println(authURL)
|
||||||
|
|
||||||
state := RandStringBytes(16)
|
state := RandStringBytes(16)
|
||||||
redirectURI := fmt.Sprintf("%s/auth/callback", "http://localhost:8096")
|
redirectURI := fmt.Sprintf("%s/auth/callback", os.Getenv("TRACKME_HOST"))
|
||||||
|
|
||||||
sess.AuthorizationEndpoint = endpoints.AuthorizationEndpoint
|
sess.AuthorizationEndpoint = endpoints.AuthorizationEndpoint
|
||||||
sess.Me = meURL.String()
|
sess.Me = meURL.String()
|
||||||
|
|
3
main.go
3
main.go
|
@ -37,6 +37,5 @@ func main() {
|
||||||
http.Handle("/auth/", http.StripPrefix("/auth/", &IndieAuthHandler{}))
|
http.Handle("/auth/", http.StripPrefix("/auth/", &IndieAuthHandler{}))
|
||||||
http.Handle("/", &indexHandler{DB: db})
|
http.Handle("/", &indexHandler{DB: db})
|
||||||
http.Handle("/moment", &momentHandler{DB: db})
|
http.Handle("/moment", &momentHandler{DB: db})
|
||||||
log.Fatal(http.ListenAndServe(":8096", nil))
|
log.Fatal(http.ListenAndServe(":8095", nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
util.go
5
util.go
|
@ -2,10 +2,15 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rand.Seed(time.Now().Unix())
|
||||||
|
}
|
||||||
|
|
||||||
func RandStringBytes(n int) string {
|
func RandStringBytes(n int) string {
|
||||||
b := make([]byte, n)
|
b := make([]byte, n)
|
||||||
for i := range b {
|
for i := range b {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user