Skip to content

Commit

Permalink
get url from env first if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
elewis2 committed Jul 1, 2024
1 parent a947caa commit 0353d95
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pori_python/graphkb/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import hashlib
import json
import os
import logging
import re
import time
Expand Down Expand Up @@ -95,7 +96,7 @@ def cache_key(request_body) -> str:
class GraphKBConnection:
def __init__(
self,
url: str = DEFAULT_URL,
url: str = os.environ.get("GRAPHKB_URL", DEFAULT_URL),
username: str = "",
password: str = "",
use_global_cache: bool = True,
Expand Down
2 changes: 1 addition & 1 deletion pori_python/ipr/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class IprConnection:
def __init__(self, username: str, password: str, url: str = DEFAULT_URL):
def __init__(self, username: str, password: str, url: str = os.environ.get("IPR_URL", DEFAULT_URL)):
self.token = None
self.url = url
self.username = username
Expand Down
5 changes: 3 additions & 2 deletions pori_python/ipr/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
IprVariant,
)
from .util import hash_key, logger, pandas_falsy
from .constants import DEFAULT_URL

protein_letters_3to1.setdefault('Ter', '*')

SPECIFICATION = os.path.join(os.path.dirname(__file__), 'content.spec.json')
# content in the local specification should match the values in IPR_API_SPEC_JSON_URL
IPR_API_SPEC_JSON_URL = 'https://ipr-api.bcgsc.ca/api/spec.json'

# content in the local specification should match the values in IPR_API_SPEC_JSON_URL
IPR_API_SPEC_JSON_URL = f'{os.environ.get("IPR_URL", DEFAULT_URL)}/spec.json'

# TODO: GERO-307 - use SPECIFICATION json to derive the variant required and optional details defined below

Expand Down
4 changes: 2 additions & 2 deletions pori_python/ipr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def command_interface() -> None:
req.add_argument(
'-c', '--content', required=True, type=file_path, help="Report Content as JSON"
)
parser.add_argument('--ipr_url', default=DEFAULT_URL)
parser.add_argument('--graphkb_url', default=None)
parser.add_argument('--ipr_url', default=os.environ.get("IPR_URL", DEFAULT_URL))
parser.add_argument('--graphkb_url', default=os.environ.get("GRAPHKB_URL", None))
parser.add_argument('--log_level', default='info', choices=LOG_LEVELS.keys())
parser.add_argument(
'--therapeutics', default=False, help='Generate therapeutic options', action='store_true'
Expand Down

0 comments on commit 0353d95

Please sign in to comment.