source: subversion/applications/rendering/mapnik/customize-mapnik-map @ 6704

Last change on this file since 6704 was 6353, checked in by jonb, 12 years ago

Enhance osm.xml templates to set password parameter

  • Property svn:executable set to *
File size: 916 bytes
Line 
1#!/usr/bin/perl -w
2#
3#  customize-mapnik-map
4#
5
6use strict;
7
8open(IN, '<', 'osm-template.xml');
9
10while(<IN>) {
11    s/%SYMBOLS_DIR%/$ENV{MAPNIK_SYMBOLS_DIR}/;
12    s/%WORLD_BOUNDARIES_DIR%/$ENV{MAPNIK_WORLD_BOUNDARIES_DIR}/;
13    s/%DBNAME%/$ENV{MAPNIK_DBNAME}/;
14
15    if ($ENV{'MAPNIK_DBUSER'} eq '') {
16        next if m|<Parameter name="user">%DBUSER%</Parameter>|
17    } else {
18        s/%DBUSER%/$ENV{MAPNIK_DBUSER}/;
19    }
20
21    if ($ENV{'MAPNIK_DBPASS'} eq '') {
22        next if m|<Parameter name="password">%DBPASS%</Parameter>|
23    } else {
24        s/%DBPASS%/$ENV{MAPNIK_DBPASS}/;
25    }
26
27    if ($ENV{'MAPNIK_DBHOST'} eq '') {
28        next if m|<Parameter name="host">%DBHOST%</Parameter>|
29    } else {
30        s/%DBHOST%/$ENV{MAPNIK_DBHOST}/;
31    }
32    if ($ENV{'MAPNIK_DBPORT'} eq '') {
33        next if m|<Parameter name="port">%DBPORT%</Parameter>|
34    } else {
35        s/%DBPORT%/$ENV{MAPNIK_DBPORT}/;
36    }
37
38    print;
39}
40
Note: See TracBrowser for help on using the repository browser.