NETWORK_SITE_URL env var removal from files (#12727)

* NETWORK_SITE_URL env var removal from files

* NETWORK_SITE_URL back for integration tests

* Testing if env vars in settings

* Tests on bg-main and main js files

* Replace network_site variable for heroku_app

* Get current domain
This commit is contained in:
Diego López 2024-08-26 16:49:05 -06:00 коммит произвёл GitHub
Родитель 825733cedf
Коммит 0a26e65d6d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 4 добавлений и 14 удалений

5
.github/workflows/continous-integration.yml поставляемый
Просмотреть файл

@ -16,7 +16,6 @@ jobs:
env:
ALLOWED_HOSTS: localhost,mozfest.localhost,default-site.com,secondary-site.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NETWORK_SITE_URL: https://foundation.mozilla.org
PULSE_API_DOMAIN: https://network-pulse-api-production.herokuapp.com
PULSE_DOMAIN: https://www.mozillapulse.org
steps:
@ -54,7 +53,6 @@ jobs:
DJANGO_SECRET_KEY: secret
DOMAIN_REDIRECT_MIDDLEWARE_ENABLED: False
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NETWORK_SITE_URL: http://localhost:8000
PIPENV_VERBOSITY: -1
PULSE_API_DOMAIN: https://network-pulse-api-production.herokuapp.com
PULSE_DOMAIN: https://www.mozillapulse.org
@ -132,7 +130,6 @@ jobs:
DJANGO_SECRET_KEY: secret
DOMAIN_REDIRECT_MIDDLEWARE_ENABLED: False
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NETWORK_SITE_URL: http://localhost:8000
PIPENV_VERBOSITY: -1
PULSE_API_DOMAIN: https://network-pulse-api-production.herokuapp.com
PULSE_DOMAIN: https://www.mozillapulse.org
@ -146,7 +143,7 @@ jobs:
CSP_CONNECT_SRC: "*"
CSP_FONT_SRC: "'self' https://code.cdn.mozilla.net https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/fonts/ data: https://static.fundraiseup.com/common-fonts/"
CSP_IMG_SRC: "* data: blob: https://*.fundraiseup.com https://ucarecdn.com https://pay.google.com https://*.paypalobjects.com"
CSP_FRAME_SRC: "'self' https://www.google.com/recaptcha/ https://*.stripe.com https://pay.google.com https://*.paypal.com https://*.fundraiseup.com"
CSP_FRAME_SRC: "'self' https://www.google.com/recaptcha/ https://*.stripe.com https://pay.google.com https://*.paypal.com https://*.fundraiseup.com"
CSP_SCRIPT_SRC: "'self' 'unsafe-inline' https://www.google-analytics.com/analytics.js http://*.shpg.org/ https://comments.mozillafoundation.org/ https://airtable.com https://platform.twitter.com https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/gsap.min.js https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/ScrollTrigger.min.js https://*.googletagmanager.com https://*.fundraiseup.com https://mozillafoundation.tfaforms.net https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ 'unsafe-eval' https://*.stripe.com https://m.stripe.network https://*.paypal.com https://*.paypalobjects.com https://pay.google.com"
CSP_STYLE_SRC: "'self' 'unsafe-inline' https://code.cdn.mozilla.net https://platform.twitter.com https://mozillafoundation.tfaforms.net https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
SECURE_CROSS_ORIGIN_OPENER_POLICY: "same-origin-allow-popups"

Просмотреть файл

@ -43,7 +43,6 @@ jobs:
DJANGO_SECRET_KEY: secret
DOMAIN_REDIRECT_MIDDLEWARE_ENABLED: False
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NETWORK_SITE_URL: http://localhost:8000
PIPENV_VERBOSITY: -1
PULSE_API_DOMAIN: https://network-pulse-api-production.herokuapp.com
PULSE_DOMAIN: https://www.mozillapulse.org

Просмотреть файл

@ -10,8 +10,7 @@
PULSE_API_DOMAIN=https://network-pulse-api-production.herokuapp.com
PULSE_DOMAIN=https://www.mozillapulse.org
# Always add a protocol (ex: https://) in front of the NETWORK_SITE_URL, including for localhost
NETWORK_SITE_URL=http://localhost:8000
# Always add a protocol (ex: https://) in front of the URL, including for localhost
WAGTAILADMIN_BASE_URL=http://localhost:8000
DOMAIN_REDIRECT_MIDDLEWARE_ENABLED=False
TARGET_DOMAINS=foundation.mozilla.org

Просмотреть файл

@ -56,7 +56,6 @@ env = environ.Env(
HEROKU_RELEASE_VERSION=(str, None),
INDEX_PAGE_CACHE_TIMEOUT=(int, 60 * 60 * 24),
MOZFEST_DOMAIN_REDIRECT_ENABLED=(bool, False),
NETWORK_SITE_URL=(str, ""),
PETITION_TEST_CAMPAIGN_ID=(str, ""),
PNI_STATS_DB_URL=(str, None),
PULSE_API_DOMAIN=(str, ""),
@ -695,7 +694,6 @@ logging.config.dictConfig(LOGGING)
FRONTEND = {
"PULSE_API_DOMAIN": env("PULSE_API_DOMAIN"),
"PULSE_DOMAIN": env("PULSE_DOMAIN"),
"NETWORK_SITE_URL": env("NETWORK_SITE_URL"),
"TARGET_DOMAINS": env("TARGET_DOMAINS"),
"SENTRY_DSN": env("SENTRY_DSN"),
"RELEASE_VERSION": env("HEROKU_RELEASE_VERSION"),
@ -718,9 +716,6 @@ USE_COMMENTO = env("USE_COMMENTO")
# privacynotincluded statistics DB
PNI_STATS_DB_URL = env("PNI_STATS_DB_URL")
# Use network_url to check if we're running prod or not
NETWORK_SITE_URL = env("NETWORK_SITE_URL")
# Blog/Campaign index cache setting
INDEX_PAGE_CACHE_TIMEOUT = env("INDEX_PAGE_CACHE_TIMEOUT")

Просмотреть файл

@ -42,7 +42,7 @@ let main = {
this.fetchEnv((envData) => {
env = envData;
networkSiteURL = env.NETWORK_SITE_URL;
networkSiteURL = window.location.origin;
if (env.SENTRY_DSN) {
// Initialize Sentry error reporting
initializeSentry(

Просмотреть файл

@ -66,7 +66,7 @@ let main = {
this.fetchEnv((envData) => {
env = envData;
networkSiteURL = env.NETWORK_SITE_URL;
networkSiteURL = window.location.origin;
if (env.SENTRY_DSN) {
// Initialize Sentry error reporting