Re: Qs regarding AppClass -initial-env

Bill Snapper (snapper@OpenMarket.com)
Mon, 24 Mar 1997 10:21:56 -0500

Message-Id: <33369C14.15D8@openmarket.com>
Date: Mon, 24 Mar 1997 10:21:56 -0500
From: Bill Snapper <snapper@OpenMarket.com>
To: Ken Overton <kov@jhu.edu>
Subject: Re: Qs regarding AppClass -initial-env

>Now I want to use this simple authorizer in around 50 different regions, so I
>want to keep these simple lists in standard places for each region and then
>tell the authorizer where to find these config files.
>
>If I use -initial-env to pass a config-directory variable to my authorizer,
>does that mean that I'll have 50 authorizers (plus their instances) hangin
>around chewing on memory?  I guess I could deduce the config-dir from
>PATH_TRANSLATED each time, but is there another ENV variable that's passed for
>each authorization that I can exploit?

No, there's no need for 50 different authorizers.

It seems like there's at least two simple solutions to your problem.

1) You can have Region directive that computes a configuration
   directory based on some information in the HTTP request.

    For example, you could have a region command (or a bunch of region
    commands) which preceed an AuthorizeRegion directive.

    Region /foo/bar/* {
        AddCGI MY_CONFIG_URL $HEADER(url)
    }
    AuthorizeRegion /foo/bar/* MyAuthClass

    The FastCGI authorizer has the same property as standard region
    commands with the same pattern match.  It will be invoked in the
    order it is specified in the server's configuration file.  

    Therefore in the above example, you could add a region command which
    contains a bit of Tcl that sets the variable "MY_CONFIG_DIR" to
    the "url".  The authorizer could then access this variable and
    parse it to extract the info it's interested in and use this
    to construct a path to point to configuration specific info
    for example.
 
2) Your Authorizer has access to most of the standard CGI environment 
   variables.  The following four are not available to authorizers:

   CONTENT_LENGTH, PATH_INFO, PATH_TRANSLATED, and SCRIPT_NAME



Hope there's enough detail here to help you move forward.

Regards,

- Bill -
 
-- 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Bill Snapper           | Open Market, Inc.   | My opinions are my own,
Software Engineer      | 245 First St.       | and not necessarily
snapper@openmarket.com | Cambridge, MA 02142 | those of my employer, 
1-617-949-7365         |                     | Open Market Inc.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++