*: add code to serialize templates into go code

Add a small program to iterate over the templates directory and
generate a go map of name to file data. This is so we can compile
these templates into the dex binary instead of requiring files on
disk.

Also add a Makefile rule to do this automatically.
This commit is contained in:
Eric Chiang
2016-08-25 13:06:22 -07:00
parent 91ff8a16cd
commit 63a62b6754
2 changed files with 83 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ GOARCH=$(shell go env GOARCH)
build: bin/dex bin/example-app
bin/dex: FORCE
bin/dex: FORCE server/templates_default.go
@go install -ldflags $(LD_FLAGS) $(REPO_PATH)/cmd/dex
bin/example-app: FORCE
@@ -42,6 +42,9 @@ lint:
golint $$package; \
done
server/templates_default.go: $(wildcard web/templates/**)
@go run server/templates_default_gen.go
.PHONY: docker-build
docker-build: bin/dex
@docker build -t $(DOCKER_IMAGE) .