summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-04-12 16:11:42 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-04-12 17:35:53 -0700
commitb28547df2025afb7b5d8941e5553865ff5dc29a6 (patch)
tree06656410e6e7f0d99cbf34db5d9cf18ee264238f
parent42be320518d238d3f26901e17618ff604435a657 (diff)
downloadfatcat-b28547df2025afb7b5d8941e5553865ff5dc29a6.tar.gz
fatcat-b28547df2025afb7b5d8941e5553865ff5dc29a6.zip
web: consistent public API URLs
-rw-r--r--python/fatcat_web/templates/changelog.html6
-rw-r--r--python/fatcat_web/templates/editgroup_view.html2
-rw-r--r--python/fatcat_web/templates/entity_history.html2
-rw-r--r--python/fatcat_web/templates/entity_macros.html7
-rw-r--r--python/fatcat_web/templates/entity_view_metadata.html2
-rw-r--r--python/fatcat_web/web_config.py4
6 files changed, 9 insertions, 14 deletions
diff --git a/python/fatcat_web/templates/changelog.html b/python/fatcat_web/templates/changelog.html
index 3ad01d63..59630666 100644
--- a/python/fatcat_web/templates/changelog.html
+++ b/python/fatcat_web/templates/changelog.html
@@ -37,11 +37,7 @@ inspect every change all the way back to the start.
</table>
<div style="float: right; font-size: smaller;">
- {% if config.FATCAT_DOMAIN == "fatcat.wiki" %}
- <a href="https://api.fatcat.wiki/v0/changelog">As JSON via API</a>
- {% else %}
- <a href="{{ config.FATCAT_API_HOST }}/changelog">As JSON via API</a>
- {% endif %}
+ <a href="{{ config.FATCAT_PUBLIC_API_HOST }}/changelog">As JSON via API</a>
</div>
{% endblock %}
diff --git a/python/fatcat_web/templates/editgroup_view.html b/python/fatcat_web/templates/editgroup_view.html
index 6a9793f7..e1af719d 100644
--- a/python/fatcat_web/templates/editgroup_view.html
+++ b/python/fatcat_web/templates/editgroup_view.html
@@ -181,7 +181,7 @@
{{ edit_list(auth_to, editgroup, editgroup.edits.webcaptures, "webcapture", "Web Capture") }}
</div>
<div style="float: right; font-size: smaller;">
- <a href="{{ config.FATCAT_API_HOST }}/editgroup/{{ editgroup.editgroup_id }}">As JSON via API</a>
+ <a href="{{ config.FATCAT_PUBLIC_API_HOST }}/editgroup/{{ editgroup.editgroup_id }}">As JSON via API</a>
</div>
<br>
diff --git a/python/fatcat_web/templates/entity_history.html b/python/fatcat_web/templates/entity_history.html
index 0115b845..05fae0c3 100644
--- a/python/fatcat_web/templates/entity_history.html
+++ b/python/fatcat_web/templates/entity_history.html
@@ -35,7 +35,7 @@ This table only shows <i>accepted</i> edits included in the catalog, not any wor
{% endfor %}
</table>
<div style="float: right; font-size: smaller;">
- <a href="{{ config.FATCAT_API_HOST }}/{{ entity_type }}/{{ entity.ident }}/history">As JSON via API</a>
+ <a href="{{ config.FATCAT_PUBLIC_API_HOST }}/{{ entity_type }}/{{ entity.ident }}/history">As JSON via API</a>
</div>
diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html
index 9207bd48..4b0635e5 100644
--- a/python/fatcat_web/templates/entity_macros.html
+++ b/python/fatcat_web/templates/entity_macros.html
@@ -36,12 +36,7 @@
<br>Revision: <small><code><a href="/{{ entity_type }}/rev/{{ entity.revision }}">{{ entity.revision }}</a></code></small>
{% endif %}
<br>API URL: <a href="
- {%- if config.FATCAT_DOMAIN == 'dev.fatcat.wiki' -%}
- http://localhost:9411
- {%- else -%}
- https://api.{{ config.FATCAT_DOMAIN }}
- {%- endif -%}
- /v0
+ {{ config.FATCAT_PUBLIC_API_HOST -}}
{%- if editgroup and entity.ident -%}
/editgroup/{{ editgroup.editgroup_id }}{# /{{ entity_type }}/{{ entity.ident }} #}
{%- elif entity.ident -%}
diff --git a/python/fatcat_web/templates/entity_view_metadata.html b/python/fatcat_web/templates/entity_view_metadata.html
index 90ce25d9..d1bd3c30 100644
--- a/python/fatcat_web/templates/entity_view_metadata.html
+++ b/python/fatcat_web/templates/entity_view_metadata.html
@@ -7,7 +7,7 @@
<h3>Entity Metadata (schema)</h3>
{{ entity_macros.extra_metadata(entity._metadata) }}
<div style="float: right;">
- <a href="{{ config.FATCAT_API_HOST }}/{{ entity_type }}/{{ entity.ident }}">As JSON via API</a>
+ <a href="{{ config.FATCAT_PUBLIC_API_HOST }}/{{ entity_type }}/{{ entity.ident }}">As JSON via API</a>
</div>
{% if entity.extra %}
diff --git a/python/fatcat_web/web_config.py b/python/fatcat_web/web_config.py
index 25c93114..3dba933d 100644
--- a/python/fatcat_web/web_config.py
+++ b/python/fatcat_web/web_config.py
@@ -22,6 +22,10 @@ class Config(object):
FATCAT_DOMAIN = os.environ.get("FATCAT_DOMAIN", default="dev.fatcat.wiki")
FATCAT_API_AUTH_TOKEN = os.environ.get("FATCAT_API_AUTH_TOKEN", default=None)
FATCAT_API_HOST = os.environ.get("FATCAT_API_HOST", default="https://{}/v0".format(FATCAT_DOMAIN))
+ public_host_default = f"https://{FATCAT_DOMAIN}/v0"
+ if FATCAT_DOMAIN == "dev.fatcat.wiki":
+ public_host_default = FATCAT_API_HOST
+ FATCAT_PUBLIC_API_HOST = os.environ.get("FATCAT_PUBLIC_API_HOST", default=public_host_default)
# can set this to https://search.fatcat.wiki for some experimentation
ELASTICSEARCH_BACKEND = os.environ.get("ELASTICSEARCH_BACKEND", default="http://localhost:9200")