Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Commit

Permalink
Merge branch 'azure_msi' into dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	track/templates/en/index.html
  • Loading branch information
sayaHub committed Nov 23, 2018
2 parents 9694aab + 1ea740a commit 178e595
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ click==6.7
Babel==2.6.0
Flask-Caching==1.4.0
pymongo==3.7.0
azure-keyvault==1.1.0
msrestazure==0.5.1
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
'click==6.7',
'Babel==2.6.0',
'Flask-Caching==1.4.0',
'azure-keyvault==1.1.0',
'msrestazure==0.5.1'
],
extras_require={
'development': [
Expand Down
16 changes: 15 additions & 1 deletion track/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
import random

from azure.keyvault import KeyVaultClient
from msrestazure.azure_active_directory import MSIAuthentication, ServicePrincipalCredentials


class Config:
DEBUG = False
Expand All @@ -14,8 +17,19 @@ def init_app(app):


A_DAY = 60 * 60 * 24


class ProductionConfig(Config):
MONGO_URI = os.environ.get("TRACKER_MONGO_URI", None)
if os.environ.get("TRACKER_KEYVAULT_URI", None) is not None and os.environ.get("SECRET_NAME_RO", None) is not None:
KV_URI = os.environ.get("TRACKER_KEYVAULT_URI")
SECRET_NAME = os.environ.get("SECRET_NAME_RO")
creds = MSIAuthentication(resource='https://vault.azure.net')
keyvault = KeyVaultClient(creds)
MONGO_URI = keyvault.get_secret(KV_URI, SECRET_NAME, "").value

else:
MONGO_URI = os.environ.get("TRACKER_MONGO_URI", None)

CACHE_TYPE = "filesystem"
CACHE_DIR = os.environ.get("TRACKER_CACHE_DIR", "./.cache")
CACHE_DEFAULT_TIMEOUT = int(os.environ.get("TRACKER_CACHE_TIMEOUT", A_DAY))
Expand Down
1 change: 1 addition & 0 deletions track/templates/en/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <h3 class="font-bold text-xl sm:text-2xl">Domains that <br> enforce HTTPS</h3>
</section>



<script src="/static/js/https/donuts.js?{{ now() | date("%Y%m%j%H%M%S") }}"></script>
<script src="/static/js/https/organizations.js?{{ now() | date("%Y%m%j%H%M%S") }}"></script>
{% endblock %}

0 comments on commit 178e595

Please sign in to comment.