template_paths config to allow easier override of web templates

This commit is contained in:
Oliver Gorwits
2017-05-06 17:59:50 +01:00
parent 273b49b9ce
commit 2c41b2925d
6 changed files with 32 additions and 5 deletions

View File

@@ -1,5 +1,14 @@
2.036000 - 2.036000 -
[NEW FEATURES]
* template_paths config to allow easier override of web templates
* new ACL features including AND and negation
[ENHANCEMENTTS]
* renamed netdisco-daemon to netdisco-backend (and *-fg too)
[BUG FIXES] [BUG FIXES]
* Add SSL development library to Release Notes * Add SSL development library to Release Notes

View File

@@ -130,7 +130,18 @@ Value: List. Default: Empty List.
Additional library paths for the application (both web frontend and backend Additional library paths for the application (both web frontend and backend
poller daemons). You can also use a colon-separated list in the poller daemons). You can also use a colon-separated list in the
"C<NETDISCO_INC>" environment variable. "C<NETDISCO_INC>" environment variable which makes code available even earlier
in the app startup sequence.
=head3 C<template_paths>
Value: List. Default: Empty List.
Additional paths for L<Template::Toolkit> templates. Files in these paths will
be loaded before (and hence override) any templates built in to Netdisco.
If you do want to copy and override a built in web template, then create the
directories necessary (such as "ajax" or "sidebar") in this path.
=head3 C<external_databases> =head3 C<external_databases>

View File

@@ -52,8 +52,6 @@ point to the new app names, going forward. Remember to do this on upgrade:
ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/ ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/
=head1 2.035007
=head2 General Notices =head2 General Notices
This release builds a Perl SSL interface which requires OpenSSL development This release builds a Perl SSL interface which requires OpenSSL development

View File

@@ -56,6 +56,14 @@ if (setting('extra_web_plugins') and ref [] eq ref setting('extra_web_plugins'))
push @{ config->{engines}->{netdisco_template_toolkit}->{INCLUDE_PATH} }, push @{ config->{engines}->{netdisco_template_toolkit}->{INCLUDE_PATH} },
setting('views'); setting('views');
# any template paths in deployment.yml (should override plugins)
if (setting('template_paths') and ref [] eq ref setting('template_paths')) {
foreach my $path (setting('template_paths')) {
unshift @{ config->{engines}->{netdisco_template_toolkit}->{INCLUDE_PATH} },
$path;
}
}
# load cookie key from database # load cookie key from database
setting('session_cookie_key' => undef); setting('session_cookie_key' => undef);
my $sessions = schema('netdisco')->resultset('Session'); my $sessions = schema('netdisco')->resultset('Session');

View File

@@ -30,7 +30,7 @@ register 'register_template_path' => sub {
return error "bad template path to register_template_paths"; return error "bad template path to register_template_paths";
} }
push @{ config->{engines}->{netdisco_template_toolkit}->{INCLUDE_PATH} }, unshift @{ config->{engines}->{netdisco_template_toolkit}->{INCLUDE_PATH} },
dir($path, 'views')->stringify; dir($path, 'views')->stringify;
}; };

View File

@@ -12,6 +12,7 @@
log: 'warning' log: 'warning'
logger_format: '[%P] %U %L %m' logger_format: '[%P] %U %L %m'
include_paths: [] include_paths: []
template_paths: []
external_databases: [] external_databases: []
# ------------ # ------------