global_domains.py: allow syncing to a specific Git ref

This commit is contained in:
Jeremy Lin 2021-02-03 12:20:44 -08:00
parent 4628e4519d
commit 678d313836
1 changed files with 4 additions and 3 deletions

View File

@ -10,16 +10,17 @@ import urllib.request
from collections import OrderedDict from collections import OrderedDict
if len(sys.argv) != 2: if not (2 <= len(sys.argv) <= 3):
print("usage: %s <OUTPUT-FILE>" % sys.argv[0]) print("usage: %s <OUTPUT-FILE> [GIT-REF]" % sys.argv[0])
print() print()
print("This script generates a global equivalent domains JSON file from") print("This script generates a global equivalent domains JSON file from")
print("the upstream Bitwarden source repo.") print("the upstream Bitwarden source repo.")
sys.exit(1) sys.exit(1)
OUTPUT_FILE = sys.argv[1] OUTPUT_FILE = sys.argv[1]
GIT_REF = 'master' if len(sys.argv) == 2 else sys.argv[2]
BASE_URL = 'https://github.com/bitwarden/server/raw/master' BASE_URL = 'https://github.com/bitwarden/server/raw/%s' % GIT_REF
ENUMS_URL = '%s/src/Core/Enums/GlobalEquivalentDomainsType.cs' % BASE_URL ENUMS_URL = '%s/src/Core/Enums/GlobalEquivalentDomainsType.cs' % BASE_URL
DOMAIN_LISTS_URL = '%s/src/Core/Utilities/StaticStore.cs' % BASE_URL DOMAIN_LISTS_URL = '%s/src/Core/Utilities/StaticStore.cs' % BASE_URL