diff --git a/Makefile b/Makefile index 1978e09..90ca0cf 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,14 @@ OBJS=webdis.o cmd.o worker.o slog.o server.o libb64/cencode.o acl.o md5/md5.o ht CFLAGS=-O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser LDFLAGS=-levent -pthread +PREFIX ?= /usr/local +CONFDIR ?= $(DESTDIR)/etc + +INSTALL_DIRS = $(DESTDIR) \ + $(DESTDIR)/$(PREFIX) \ + $(DESTDIR)/$(PREFIX)/bin \ + $(CONFDIR) + all: $(OUT) Makefile $(OUT): $(OBJS) Makefile @@ -20,6 +28,12 @@ $(OUT): $(OBJS) Makefile %.o: %.c Makefile $(CC) -c $(CFLAGS) -o $@ $< +$(INSTALL_DIRS): + mkdir -p $@ + clean: rm -f $(OBJS) $(OUT) +install: $(OUT) $(INSTALL_DIRS) + cp $(OUT) $(DESTDIR)/$(PREFIX)/bin + cp webdis.prod.json $(CONFDIR) diff --git a/webdis.prod.json b/webdis.prod.json new file mode 100644 index 0000000..de35ca8 --- /dev/null +++ b/webdis.prod.json @@ -0,0 +1,28 @@ +{ + "redis_host": "127.0.0.1", + + "redis_port": 6379, + "redis_auth": null, + + "http_host": "0.0.0.0", + "http_port": 7379, + "threads": 4, + + "daemonize": true, + + "database": 0, + + "acl": [ + { + "disabled": ["DEBUG"] + }, + + { + "http_basic_auth": "user:password", + "enabled": ["DEBUG"] + } + ], + + "verbosity": 3, + "logfile": "/var/log/webdis.log" +}