Last active
January 10, 2023 17:40
-
-
Save jennings/785ff799a8859892472f5f2f813b2c57 to your computer and use it in GitHub Desktop.
Run Azurite over HTTPS with a trusted certificate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile for running Azurite with or without HTTPS. Requires the | |
# mkcert and azurite commands to be available. | |
# | |
# Usage: | |
# make - Run Azurite with HTTPS | |
# make https - Run Azurite with HTTPS | |
# make http - Run Azurite with HTTP | |
# make install - Create certificates using mkcert (runs automatically) | |
# make reset - Clear the Azurite database | |
HOSTNAME := 127.0.0.1 | |
CERT := $(HOSTNAME).pem | |
KEY := $(HOSTNAME)-key.pem | |
ROOT_FLAG := .root-installed | |
.PHONY: all | |
all: https | |
.PHONY: https | |
https: install | |
azurite --oauth basic -l data --cert $(CERT) --key $(KEY) | |
.PHONY: http | |
http: | |
azurite --oauth basic -l data | |
.PHONY: reset | |
reset: | |
ifeq ($(OS),Windows_NT) | |
del /q /s data | |
else | |
rm -rf data | |
endif | |
.PHONY: install | |
install: $(CERT) $(KEY) | |
$(ROOT_FLAG): | |
mkcert -install | |
ifeq ($(OS),Windows_NT) | |
powershell -NoProfile -Command (New-Item -Force .root-installed).LastWriteTime = Get-Date | |
else | |
touch .root-installed | |
endif | |
$(CERT) $(KEY) &: $(ROOT_FLAG) | |
mkcert $(HOSTNAME) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment