Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Unified Diff: tools/origin_trials/generate_token.py

Issue 2230673002: origin_trials/generate_token.py: Look for default key in script dir. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/origin_trials/generate_token.py
diff --git a/tools/origin_trials/generate_token.py b/tools/origin_trials/generate_token.py
index 1dca546fec7f7d0ce34779e9c0032002930812af..268f4567d19209af982274cba66edc6a39fdd770 100755
--- a/tools/origin_trials/generate_token.py
+++ b/tools/origin_trials/generate_token.py
@@ -35,6 +35,9 @@ DNS_LABEL_REGEX = re.compile(r"^(?!-)[a-z\d-]{1,63}(?<!-)$", re.IGNORECASE)
# This script generates Version 2 tokens.
VERSION = "\x02"
+# Default key file, relative to script_dir.
+DEFAULT_KEY_FILE = 'eftest.key'
+
def HostnameFromArg(arg):
"""Determines whether a string represents a valid hostname.
@@ -98,6 +101,8 @@ def FormatToken(version, signature, data):
struct.pack(">I",len(data)) + data)
def main():
+ default_key_file_absolute = os.path.join(script_dir, DEFAULT_KEY_FILE)
+
parser = argparse.ArgumentParser(
description="Generate tokens for enabling experimental APIs")
parser.add_argument("origin",
@@ -111,7 +116,7 @@ def main():
"RuntimeFeatures.in")
parser.add_argument("--key-file",
help="Ed25519 private key file to sign the token with",
- default="eftest.key")
+ default=default_key_file_absolute)
expiry_group = parser.add_mutually_exclusive_group()
expiry_group.add_argument("--expire-days",
help="Days from now when the token should exipire",
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698