Skip to content
Permalink
Browse files

Make sure dev help page doesn't show up on prod (#4045)

* Make sure dev help page doesn't show up on prod

* Add an env var for review app + update old usage of HEROKU_APP_NAME

* Update network-api/networkapi/context_processor.py

Co-Authored-By: Christopher DeCairos <christopherd@mozillafoundation.org>

* Update network-api/networkapi/settings.py

Co-Authored-By: Christopher DeCairos <christopherd@mozillafoundation.org>
  • Loading branch information
patjouk and cadecairos committed Dec 10, 2019
1 parent ed2e34c commit 33111a7fe4eca94b37d476f6b42357f961b334e6
@@ -66,7 +66,8 @@
"CSP_MEDIA_SRC": "'self'",
"CSP_CHILD_SRC": "'self'",
"CSP_FORM_ACTION": "'self' https://www.mozilla.org/en-US/newsletter/",
"NPM_CONFIG_PRODUCTION": "true"
"NPM_CONFIG_PRODUCTION": "true",
"REVIEW_APP": "True"
},
"buildpacks": [
{
@@ -43,6 +43,9 @@ Opening a PR activates different services:

Opening a PR will automatically create a review app in the `foundation-site` pipeline. It's not possible to use OAuth but you can still access the admin interface with a username and password. The login details for review apps are published in the `mofo-ra-foundation` Slack channel when the app has finished deploying.

Environment variable:
- `REVIEW_APP`: set to True on review app.

### Continuous Integration testing

Opening a PR will trigger [Travis](https://travis-ci.org) continuous integration, which should pass before a PR is deemed good to merge.
@@ -632,7 +632,7 @@ class Meta:
@receiver(pre_delete, sender=Product)
def delete_image(sender, instance, **kwargs):
# We want to keep our review app placeholders
if settings.HEROKU_APP_NAME:
if settings.REVIEW_APP:
pass
else:
if instance.cloudinary_image:
@@ -3,7 +3,7 @@

# Used to export env variable to Django templates
def review_app(request):
return {'HEROKU_APP_NAME': settings.HEROKU_APP_NAME}
return {'REVIEW_APP': settings.REVIEW_APP}


# Used in BuyersGuide templates to check if we're using cloudinary
@@ -79,7 +79,8 @@
DATA_UPLOAD_MAX_NUMBER_FIELDS=(int, 2500),
# Sentry
SENTRY_DSN=(str, None),
HEROKU_RELEASE_VERSION=(str, None)
HEROKU_RELEASE_VERSION=(str, None),
REVIEW_APP=(bool, False),
)

# Read in the environment
@@ -100,6 +101,9 @@
release=HEROKU_RELEASE_VERSION
)

# At True when running on a review app
REVIEW_APP = env('REVIEW_APP', default=False)

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = root()

@@ -4,4 +4,4 @@
{{ pre }}<a class="{% primary_active_nav request menu_root.full_url item.full_url %}" href="{{ item.url }}">{{ item.title }}</a>{{ post }}
{% endfor %}

{% if HEROKU_APP_NAME %}{{ pre }}<a href="/help">DEV HELP</a>{{ post }}{% endif %}
{% if REVIEW_APP %}{{ pre }}<a href="/help">DEV HELP</a>{{ post }}{% endif %}
@@ -16,7 +16,7 @@ def get(self, request):

def review_app_help_view(request):
try:
if settings.HEROKU_APP_NAME:
if settings.REVIEW_APP:
return render(request, 'reviewapp-help.html')
except AttributeError:
raise Http404()

0 comments on commit 33111a7

Please sign in to comment.
You can’t perform that action at this time.