Skip to content

Commit 3b2291f

Browse files
committed
dynamically manages tosdr url via store for dev env (to-do : staging, prod)
1 parent fe262b8 commit 3b2291f

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

conf/development-app.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ h.bouncer_url: http://localhost:8000
1414
h.client_rpc_allowed_origins: http://localhost:8001 https://localhost:48001
1515
h.client_url: {current_scheme}://{current_host}:3001/hypothesis
1616
h.websocket_url: ws://localhost:5001/ws
17+
h.tosdr: http://localhost:9090
1718

1819
h.debug: True
1920
h.reload_assets: True

h/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def configure(environ=None, settings=None): # pylint: disable=too-many-statemen
2828
environ = os.environ
2929
if settings is None:
3030
settings = {}
31+
3132
settings_manager = SettingsManager(settings, environ)
3233
# Configuration for external components
3334
settings_manager.set("broker_url", "BROKER_URL")
@@ -87,6 +88,9 @@ def configure(environ=None, settings=None): # pylint: disable=too-many-statemen
8788
# secret.
8889
settings_manager.set("h.client_oauth_id", "CLIENT_OAUTH_ID")
8990

91+
# Base domain for tosdr
92+
settings_manager.set("h.tosdr", "TOSDR_URL")
93+
9094
# The list of origins that the client will respond to cross-origin RPC
9195
# requests from.
9296
settings_manager.set(

h/views/api/links.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from h.views.api.config import api_config
23
from h.views.api.helpers.angular import AngularRouteTemplater
34

@@ -18,6 +19,9 @@ def links(_context, request):
1819
tag_search_url = request.route_url("activity.search", _query={"q": 'tag:"__tag__"'})
1920
tag_search_url = tag_search_url.replace("__tag__", ":tag")
2021

22+
settings = request.registry.settings
23+
tosdr_url = settings.get("h.tosdr")
24+
2125
oauth_authorize_url = request.route_url("oauth_authorize")
2226
oauth_revoke_url = request.route_url("oauth_revoke")
2327

@@ -34,4 +38,5 @@ def links(_context, request):
3438
"signup": request.route_url("signup"),
3539
"user": templater.route_template("stream.user_query"),
3640
"websocket": websocket_url,
41+
"tosdr": tosdr_url
3742
}

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ passenv =
5656
dev: SENTRY_DSN_CLIENT
5757
dev: SENTRY_DSN_FRONTEND
5858
dev: SENTRY_ENVIRONMENT
59+
dev: TOSDR_URL
5960
dev: USE_HTTPS
6061
dev: NEW_RELIC_LICENSE_KEY
6162
dev: NEW_RELIC_APP_NAME

0 commit comments

Comments
 (0)