From 9daad3426ec79bc71f6f259bb30943545b7dc26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Pe=CC=81rez=20Crespo?= <jaime.perez@uninett.no> Date: Wed, 25 Oct 2017 11:00:18 +0200 Subject: [PATCH] Add a configuration option to indicate we are running in production. This can be used by templates to load resources in different ways, either optimized for the developer or for a production environment. --- config-templates/config.php | 11 +++++++++++ lib/SimpleSAML/XHTML/Template.php | 1 + 2 files changed, 12 insertions(+) diff --git a/config-templates/config.php b/config-templates/config.php index c63138dc9..bc94a9d50 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -797,6 +797,17 @@ $config = array( */ 'template.auto_reload' => false, + /* + * Set this option to true to indicate that your installation of SimpleSAMLphp + * is running in a production environment. This will affect the way resources + * are used, offering an optimized version when running in production, and an + * easy-to-debug one when not. Set it to false when you are testing or + * developing the software. + * + * Defaults to true. + */ + 'production' => true, + /********************* diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 56e05b372..879f20733 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -247,6 +247,7 @@ class SimpleSAML_XHTML_Template } $twig->addGlobal('queryParams', $queryParams); $twig->addGlobal('templateId', str_replace('.twig', '', $this->normalizeTemplateName($this->template))); + $twig->addGlobal('isProduction', $this->configuration->getBoolean('production', true)); // add a filter for translations out of arrays $twig->addFilter( -- GitLab