-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
28 lines (21 loc) · 944 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
SHELL=/bin/bash
include .env
.PHONY: help
help: ## display help section
@ cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: deploy
deploy: prepare ## deploy to cf workers
@ npx wrangler deploy --var BUCKET:$(KV_BINDING)
.PHONY: config-upload
config-upload: ## upload config to kv storage. "name" arg should be provided
@ echo $(TOKEN) | npx wrangler secret put TOKEN
@ npx wrangler kv:key put CONFIG --path=$(name) --namespace-id=$(KV_ID)
.PHONY: prepare
prepare: ## prepare developing environment
@ sed -i -e "s/KV_BINDING/$(KV_BINDING)/" -e "s/KV_ID/$(KV_ID)/" wrangler.toml
.PHONY: dev-config
dev-config: ## write config locally
@ npx wrangler kv:key put CONFIG --path=$(name) --binding $(KV_BINDING) --local
.PHONY: dev
dev: prepare ## run the project locally
@ npx wrangler dev --port 8780 --var BUCKET:$(KV_BINDING) TOKEN:$(TOKEN)