Variable Substitution on MapServer
Bayu F. Aprianto
bayu at STUDENT.UGM.AC.ID
Thu Jun 30 05:18:06 PDT 2005
Hi, i've read a map file reference of MapServer version 4.6, here is a
sample.
"Variable Substitution
New in MapServer 4.0, variables can be substituted within mapfile
parameter values. At this time, cookie and CGI parameter values are
supported. This allows mapserver mapfiles to be aware of a user's cookies
(Good for implementing security), or non-mapserver request parameters
(Good for integrating with other systems).
Syntax: '%' + variable name + '%'
Example 1. Connecting securely to a Spatial Database
You want to map some senstitive data held in a PostGIS database. The
username and password to be used for the database connection are held in 2
cookies previously set by a seperate authentication mechanism, "uid" and
"passwd".
CONNECTION "user=%uid% password=%passwd% dbname=postgis"
This feature is only available in the CGI version of MapServer through a
mapfile pre-processor. If you are using MapScript, you will have to code
the substitution logic into your application yourself (By writing your own
pre-processor)."
I have a question, how to implement the variable substitution (e.g.
Password) on Map File for PostGIS connection? for example: CONNECTION
"HOST=localhost PORT=5432 DBNAME=data USER=postgres PASSWORD=12345" How to
hide my username and password for connection to PostgreSQL?
Thanks.
Bayu
More information about the MapServer-users
mailing list