Skip to content

Commit

Permalink
Enabled TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
metamemelord committed Sep 1, 2022
1 parent e3e9ad8 commit 4bef511
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Docker
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DOMAIN: gaurav.dev

on:
push:
Expand Down Expand Up @@ -88,13 +89,17 @@ jobs:
-e MS_TENANT_ID="${{ secrets.CONTAINER_MS_TENANT_ID }}" \
-e SELF_EMAIL="${{ secrets.CONTAINER_SELF_EMAIL }}" \
-e PORT="${{ secrets.CONTAINER_INTERNAL_PORT }}" \
-e TLS_ENABLED="${{ secrets.CONTAINER_TLS_ENABLED }}" \
-e TLS_CERT_PATH="${{ secrets.CONTAINER_INTERNAL_TLS_CERTS_DIR }}/cert.pem" \
-e TLS_KEY_PATH="${{ secrets.CONTAINER_INTERNAL_TLS_CERTS_DIR }}/key.pem" \
-v ${{ secrets.CONTAINER_EXTERNAL_TLS_CERTS_DIR }}:${{ secrets.CONTAINER_INTERNAL_TLS_CERTS_DIR }}/:Z \
--name "${{ secrets.CONTAINER_NAME }}" \
${{ steps.meta.outputs.tags }}
set -o history
- name: Check service health
uses: jtalk/url-health-check-action@v2
with:
url: http://${{ secrets.SSH_HOST }}/health
url: https://${{ env.DOMAIN }}/health
follow-redirect: false
max-attempts: 5
retry-delay: 5s
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ yarn-error.log*
portfolio-website
model/metadataitemtype_enumer.go
server
certs/*
7 changes: 6 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,10 @@ func main() {
go worker.KeepAlive(time.Minute)
}

_ = g.Run(PORT)
tlsEnabled := os.Getenv("TLS_ENABLED")
if tlsEnabled == "true" || tlsEnabled == "1" {
_ = g.RunTLS(PORT, os.Getenv("TLS_CERT_PATH"), os.Getenv("TLS_KEY_PATH"))
} else {
_ = g.Run(PORT)
}
}

0 comments on commit 4bef511

Please sign in to comment.