[mapserver-users] Setting a connection host from ENV
Seth G
sethg at geographika.co.uk
Sat Aug 1 01:39:37 PDT 2020
Hi Ben,
The only environment variables used by MapServer are listed here [2]
For updating other parameters I think you only have 2 choices:
1. Use runtime substitution https://mapserver.org/cgi/runsub.html#parameters-supported
2. Create deployment specific Mapfiles. There are a few choices for this - sed as you mentioned, but also MapScript. For a similar situation I use mappyfile [1] (a Python Mapfile parser).
Seth
[1] https://mappyfile.readthedocs.io/en/latest/#modifying-values
[2] https://mapserver.org/environment_variables.html
--
web:http://geographika.co.uk
twitter: @geographika
On Wed, Jul 29, 2020, at 4:44 PM, Ben Madin wrote:
> G'day all,
>
> I am migrating a number of systems onto containers, and have hit a blocker with a solution with over 100 mapfiles, all of which refer to a database that is tucked away in a vpc in the cloud, with an a record for the connection host (ie host.cloud.com)
>
> I also have a copy of the database on a development machine (ie host.docker.internal)
>
> For most everything else in the docker world (our web interfaces etc), I can set use env variables in the container system, but I'm really struggling with how best to do this in this case. I can do a url variable for the connection parameter, and specify the database in every call... seems pretty clumsy, and not good practice really. but my attempts to reference environment variables in the mapfile have been very unsuccessful.
>
> Could I ask :
>
> a) is there actually a simpler way to achieve the same outcome, that I have completely missed, or
>
> b) does someone have an example of how to do it?
>
> c) is this actually just not possible, and I should just get my sed out before every deployment commit?
>
> cheers
>
> Ben
>
>
> --
>
> Ausvet Logo <https://www.ausvet.com.au/>
>
> Dr Ben Madin
>
> BVMS MVPHMgmt PhD MANZCVS GAICD
>
> Managing Director
> Mobile:
> +61 448 887 220 <tel:+61448887220>
> E-mail:
> ben at ausvet.com.au
> Website:
> www.ausvet.com.au
> Skype: benmadin
> Address:
> 5 Shuffrey Street
> Fremantle, WA 6160
> Australia
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20200801/81c79e3d/attachment.htm>
More information about the MapServer-users
mailing list