Skip to content

Commit fed682a

Browse files
committed
Make outbound proxy configurable in settings and eliminate duplicate proxy class
1 parent ae13620 commit fed682a

File tree

3 files changed

+33
-18
lines changed

3 files changed

+33
-18
lines changed

.github/github_settings.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,22 @@ def get_env_variable(var_name, default=None):
617617
# This is the default if source isn't set as a parameter in the request
618618
TILESERVER_URL = "https://openmaps.gov.bc.ca/"
619619
BC_TILESERVER_URLS = {
620-
"maps": "https://maps.gov.bc.ca/",
621-
"openmaps": TILESERVER_URL,
622-
"local": "http://localhost:7800/",
620+
"maps": {
621+
"url": "https://maps.gov.bc.ca/",
622+
"use_outbound_proxy": True, # Use outbound proxy for this source
623+
},
624+
"openmaps": {
625+
"url": TILESERVER_URL,
626+
"use_outbound_proxy": True, # Use outbound proxy for this source
627+
},
628+
"local": {
629+
"url": get_env_variable("TILESERVER_LOCAL_URL"),
630+
"use_outbound_proxy": False, # Local doesn't need outbound proxy
631+
},
632+
"local-feature": {
633+
"url": get_env_variable("FEATURESERVER_LOCAL_URL"),
634+
"use_outbound_proxy": False, # Local doesn't need outbound proxy
635+
},
623636
}
624637

625638
AUTH_BYPASS_HOSTS = get_env_variable("AUTH_BYPASS_HOSTS", default="localhost")

bcap/settings.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -699,10 +699,22 @@ def get_env_variable(var_name, is_optional=False):
699699
# This is the default if source isn't set as a parameter in the request
700700
TILESERVER_URL = "https://openmaps.gov.bc.ca/"
701701
BC_TILESERVER_URLS = {
702-
"maps": "https://maps.gov.bc.ca/",
703-
"openmaps": TILESERVER_URL,
704-
"local": get_env_variable("TILESERVER_LOCAL_URL"),
705-
"local-feature": get_env_variable("FEATURESERVER_LOCAL_URL"),
702+
"maps": {
703+
"url": "https://maps.gov.bc.ca/",
704+
"use_outbound_proxy": True # Use outbound proxy for this source
705+
},
706+
"openmaps": {
707+
"url": TILESERVER_URL,
708+
"use_outbound_proxy": True # Don't use outbound proxy for this source
709+
},
710+
"local": {
711+
"url": get_env_variable("TILESERVER_LOCAL_URL"),
712+
"use_outbound_proxy": False # Local doesn't need outbound proxy
713+
},
714+
"local-feature": {
715+
"url": get_env_variable("FEATURESERVER_LOCAL_URL"),
716+
"use_outbound_proxy": False # Local doesn't need outbound proxy
717+
},
706718
}
707719

708720
AUTH_BYPASS_HOSTS = get_env_variable("AUTH_BYPASS_HOSTS")

bcap/urls.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
TranslateToResourceTypeView,
1515
)
1616
from bcap.views.resource import ResourceReportView, ResourceEditLogView
17-
from bcgov_arches_common.views.map import BCTileserverProxyView, BCTileserverLocalProxyView
17+
from bcgov_arches_common.views.map import BCTileserverProxyView
1818

1919
uuid_regex = settings.UUID_REGEX
2020

@@ -39,16 +39,6 @@
3939
BCTileserverProxyView.as_view(),
4040
name="bcap_tile_server",
4141
),
42-
path(
43-
f"{PREFIX}bclocaltileserver/",
44-
BCTileserverLocalProxyView.as_view(),
45-
name="bcap_local_tile_server_root",
46-
),
47-
path(
48-
f"{PREFIX}bclocaltileserver/<path:path>",
49-
BCTileserverLocalProxyView.as_view(),
50-
name="bcap_local_tile_server",
51-
),
5242
path(
5343
f"{PREFIX}borden_number/<uuid:resourceinstanceid>",
5444
BordenNumber.as_view(),

0 commit comments

Comments
 (0)