Skip to content

Instantly share code, notes, and snippets.

@jennings
Last active January 10, 2023 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jennings/785ff799a8859892472f5f2f813b2c57 to your computer and use it in GitHub Desktop.
Save jennings/785ff799a8859892472f5f2f813b2c57 to your computer and use it in GitHub Desktop.
Run Azurite over HTTPS with a trusted certificate
# 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