mirror of
https://github.com/zulip/zulip.git
synced 2026-06-21 21:32:29 +08:00
template context: Eliminate now-constant variable api_site_required.
This commit is contained in:
parent
bf1395b3ec
commit
aeb69dfd61
@ -102,8 +102,7 @@ Here are a few common macros used to document Zulip's integrations:
|
||||
`{{ external_api_uri }}` template variable, so that your integration
|
||||
documentation will provide the correct URL for whatever server it is
|
||||
deployed on. If special configuration is required to set the SITE
|
||||
variable, you should document that too, inside an `{% if
|
||||
api_site_required %}` check.
|
||||
variable, you should document that too.
|
||||
|
||||
* **Example usage:**
|
||||
```
|
||||
|
||||
@ -106,24 +106,24 @@ Sample steps to do:
|
||||
|
||||
<h4>Stream message</h4>
|
||||
<div class="codehilite"><pre>zulip-send --stream Denmark --subject Castle \
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5{% if api_site_required %} \
|
||||
--site={{ external_api_uri_subdomain }}{% endif %}</pre></div>
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \
|
||||
--site={{ external_api_uri_subdomain }}</pre></div>
|
||||
|
||||
<h4>Private message</h4>
|
||||
<div class="codehilite"><pre>zulip-send hamlet@example.com \
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5{% if api_site_required %} \
|
||||
--site={{ external_api_uri_subdomain }}{% endif %}</pre></div>
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \
|
||||
--site={{ external_api_uri_subdomain }}</pre></div>
|
||||
|
||||
<h4>Passing in the message on the command-line</h4>
|
||||
<p>If you'd like, you can also provide the message on the command-line with the <code>-m</code> flag, as follows:</p>
|
||||
<div class="codehilite"><pre>zulip-send --stream Denmark --subject Castle \
|
||||
-m <span class="s2">"Something is rotten in the state of Denmark."</span> \
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5{% if api_site_required %} \
|
||||
--site={{ external_api_uri_subdomain }}{% endif %}
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \
|
||||
--site={{ external_api_uri_subdomain }}
|
||||
</pre></div>
|
||||
|
||||
<p>You can omit the <code>user</code>{% if api_site_required %}, <code>api-key</code>, and
|
||||
<code>site</code>{% else %} and <code>api-key</code>{% endif %} arguments if you have a
|
||||
<p>You can omit the <code>user</code>, <code>api-key</code>, and
|
||||
<code>site</code> arguments if you have a
|
||||
<code>~/.zuliprc</code> file.
|
||||
</p>
|
||||
<p>See also the <a href="/api/endpoints">full API endpoint documentation.</a></p>
|
||||
@ -192,7 +192,7 @@ Sample steps to do:
|
||||
<div class="codehilite"><pre><span class="k">[api]</span>
|
||||
<span class="na">key</span><span class="o">=</span><span class="s">BOT_API_KEY</span>
|
||||
<span class="na">email</span><span class="o">=</span><span class="s">BOT_EMAIL_ADDRESS</span>
|
||||
{% if api_site_required %}<span class="na">site</span><span class="o">=</span><span class="s">{{ external_api_uri_subdomain }}</span>{% endif %}</pre></div>
|
||||
<span class="na">site</span><span class="o">=</span><span class="s">{{ external_api_uri_subdomain }}</span></pre></div>
|
||||
|
||||
<p>Additionally, you can also specify the parameters as environment variables as follows:</p>
|
||||
<div class="codehilite"><pre><span></span><span class="nb">export</span> <span class="nv">ZULIP_CONFIG</span><span class="o">=</span>/path/to/zulipconfig
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
```
|
||||
ZULIP_USER = "{{ integration_name }}-bot@example.com"
|
||||
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
||||
{% if api_site_required %}ZULIP_SITE = "{{ external_api_uri_subdomain }}"{% endif %}
|
||||
ZULIP_SITE = "{{ external_api_uri_subdomain }}"
|
||||
```
|
||||
|
||||
@ -20,7 +20,7 @@ hook if it installs in a different location on this system:
|
||||
email = "hg-bot@example.com"
|
||||
api_key = "0123456789abcdefg"
|
||||
stream = "commits"
|
||||
{% if api_site_required %}site = {{ external_api_uri_subdomain }}{% endif %}
|
||||
site = {{ external_api_uri_subdomain }}
|
||||
|
||||
That’s all it takes for the basic setup! On the next `hg push`, you’ll
|
||||
get a Zulip update for the changeset.
|
||||
@ -44,7 +44,7 @@ notifications:
|
||||
api_key = "0123456789abcdefg"
|
||||
stream = "commits"
|
||||
web_url = "http://hg.example.com:8000/"
|
||||
{% if api_site_required %}site = {{ external_api_uri_subdomain }}{% endif %}
|
||||
site = {{ external_api_uri_subdomain }}
|
||||
|
||||
[1]: http://mercurial.selenic.com/wiki/QuickStart#Network_support
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ on your Nagios server:
|
||||
[api]
|
||||
email = NAGIOS_BOT_EMAIL_ADDRESS
|
||||
key = NAGIOS_BOT_API_KEY
|
||||
{% if api_site_required %}site = {{ external_api_uri_subdomain }}{% endif %}
|
||||
site = {{ external_api_uri_subdomain }}
|
||||
```
|
||||
|
||||
Copy `integrations/nagios/zulip_nagios.cfg` to `/etc/nagios3/conf.d`
|
||||
|
||||
@ -120,7 +120,6 @@ def zulip_default_context(request):
|
||||
'realm_icon': realm_icon,
|
||||
'realm_description': realm_description,
|
||||
'root_domain_uri': settings.ROOT_DOMAIN_URI,
|
||||
'api_site_required': True,
|
||||
'email_gateway_example': settings.EMAIL_GATEWAY_EXAMPLE,
|
||||
'apps_page_url': apps_page_url,
|
||||
'open_realm_creation': settings.OPEN_REALM_CREATION,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user