aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2020-01-31 18:18:31 +0000
committerr <r@freesoftwareextremist.com>2020-01-31 18:18:31 +0000
commitcd9306294d18d0b357fae3c1894b4f3f2d14c9c0 (patch)
tree925e8e10a0eb58ae689726a8bf6ffada949a16d3
parenta981085260af2623bd4988e4b9c0052e2e3035eb (diff)
downloadbloat-cd9306294d18d0b357fae3c1894b4f3f2d14c9c0.tar.gz
bloat-cd9306294d18d0b357fae3c1894b4f3f2d14c9c0.zip
Add install target for make
- Update default config path accordingly - Mention use of config file in README
-rw-r--r--Makefile27
-rw-r--r--README6
-rw-r--r--main.go2
-rw-r--r--service/transport.go3
4 files changed, 29 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 780f6e8..2ebd9df 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/README b/README
index 57bd0e0..8e0bc52 100644
--- a/README
+++ b/README
@@ -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
diff --git a/main.go b/main.go
index 18e474c..a634e34 100644
--- a/main.go
+++ b/main.go
@@ -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
}