-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
38 lines (31 loc) · 1020 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
LOG_LEVEL ?= wagi=debug
MODULES_TOML ?= examples/modules.toml
MODULE_CACHE ?= _scratch/cache
BINDLE ?= example.com/hello/1.3.3
BINDLE_URL ?= http://localhost:8080/v1
WAGI_IFACE ?= 127.0.0.1:3000
WAGI_HOST ?= localhost:3000
CERT_NAME ?= ssl-example
TLS_OPTS ?= --tls-cert $(CERT_NAME).crt.pem --tls-key $(CERT_NAME).key.pem
.PHONY: build
build:
cargo build --release
.PHONY: serve
serve: TLS_OPTS =
serve: _run
.PHONY: serve-tls
serve-tls: ${CERT_NAME}.crt.pem
serve-tls: _run
.PHONY: _run
_run:
mkdir -p $(MODULE_CACHE)
RUST_LOG=$(LOG_LEVEL) cargo run --release -- -c $(MODULES_TOML) --module-cache $(MODULE_CACHE) $(TLS_OPTS)
.PHONY: run-bindle
run-bindle:
mkdir -p $(MODULE_CACHE)
RUST_LOG=$(LOG_LEVEL) cargo run --release -- -b $(BINDLE) --module-cache $(MODULE_CACHE) --bindle-url $(BINDLE_URL) --listen $(WAGI_IFACE) --hostname $(WAGI_HOST)
.PHONY: test
test:
cargo test
$(CERT_NAME).crt.pem:
openssl req -newkey rsa:2048 -nodes -keyout $(CERT_NAME).key.pem -x509 -days 365 -out $(CERT_NAME).crt.pem