Skip to content

Commit 662e341

Browse files
committedJan 7, 2012
More template variable pruning. You should just use the config object.
1 parent dd81abc commit 662e341

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed
 

‎wre/lib/WRE/File.pm

+1-7
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ Either a path to a template file as a scalar or a scalar reference to a template
313313
=head3 vars
314314
315315
A hash reference containing the template variables to process on the template. The following template variables
316-
are automatically generated and added to the list: databaseHost, databasePort, nginxPort, starmanPort,
317-
domainRoot, wreRoot, webguiRoot
316+
are automatically generated and added to the list: domainRoot, wreRoot, webguiRoot, config.
318317
319318
=cut
320319

@@ -331,13 +330,8 @@ sub processTemplate {
331330

332331
# add in some template template variables
333332
$var->{config} = $config;
334-
$var->{databaseHost} = $config->get("mysql/hostname");
335-
$var->{databasePort} = $config->get("mysql/port");
336-
$var->{nginxPort} = $config->get("nginx/port");
337-
$var->{starmanPort} = $config->get("starman/port");
338333
$var->{domainRoot} = $config->getDomainRoot;
339334
$var->{wreRoot} = $config->getRoot;
340-
$var->{wreUser} = $config->get("user");
341335
$var->{webguiRoot} = $config->getWebguiRoot;
342336

343337
# cache template

‎wre/t/File.t

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ is(-f file($recursiveDir2."/ab/a")->stringify, 1, "recursive copy() subdirectory
8787

8888

8989
# processTemplate
90-
my $content = "This is my starmsn port: [% starmanPort %].";
90+
my $content = "This is my starmsn port: [% config.get('starman/port') %].";
9191
my $evaluatedContent = "This is my starman port: 8081.";
9292
is(${$file->processTemplate(\$content)}, $evaluatedContent, "processTemplate() with scalarref");
9393

0 commit comments

Comments
 (0)
Please sign in to comment.