diff options
-rw-r--r-- | Makefile | 27 | ||||
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | main.go | 2 | ||||
-rw-r--r-- | service/transport.go | 3 |
4 files changed, 29 insertions, 9 deletions
@@ -1,11 +1,32 @@ GO=go +BINPATH=/usr/local/bin +DATAPATH=/var/bloat +ETCPATH=/etc all: bloat -PHONY: - -bloat: main.go PHONY +bloat: main.go $(GO) build $(GOFLAGS) -o bloat main.go +install: bloat + cp bloat $(BINPATH)/bloat + chmod 0755 $(BINPATH)/bloat + mkdir -p $(DATAPATH)/database + cp -r templates $(DATAPATH)/ + cp -r static $(DATAPATH)/ + sed -e "s%=database%=$(DATAPATH)/database%g" \ + -e "s%=templates%=$(DATAPATH)/templates%g" \ + -e "s%=static%=$(DATAPATH)/static%g" \ + < bloat.conf > $(ETCPATH)/bloat.conf + +uninstall: + rm -f $(BINPATH)/bloat + rm -fr $(DATAPATH)/templates + rm -fr $(DATAPATH)/static + rm -f $(ETCPATH)/bloat.conf + +clean: + rm -f bloat + run: bloat ./bloat @@ -18,17 +18,17 @@ External dependencies: Building and Installation: -Make sure you have GO installed. Other dependencies will be downloaded +Make sure you have Go installed. Other dependencies will be downloaded automatically. Typing make will build the binary $ make Edit the provided config file. See the default.conf file for more details. -$ ed default.conf +$ ed bloat.conf Run the binary -$ ./bloat +$ ./bloat -f bloat.conf You can now access the frontend at http://localhost:8080, which is the default listen address. You can also setup a reverse HTTP proxy to serve the frontend over @@ -20,7 +20,7 @@ import ( ) var ( - configFile = "bloat.conf" + configFile = "/etc/bloat.conf" ) func init() { diff --git a/service/transport.go b/service/transport.go index d945e18..02168e8 100644 --- a/service/transport.go +++ b/service/transport.go @@ -6,7 +6,6 @@ import ( "io" "mime/multipart" "net/http" - "path" "strconv" "time" @@ -595,7 +594,7 @@ func NewHandler(s Service, staticDir string) http.Handler { r.HandleFunc("/fluoride/retweet/{id}", fRetweet).Methods(http.MethodPost) r.HandleFunc("/fluoride/unretweet/{id}", fUnretweet).Methods(http.MethodPost) r.PathPrefix("/static").Handler(http.StripPrefix("/static", - http.FileServer(http.Dir(path.Join(".", staticDir))))) + http.FileServer(http.Dir(staticDir)))) return r } |