how to dynamically set QIBM_CGI_LIBRARY_LIST in APACHE?

Any IBM i topic that does not fit in another forum
Post Reply
gracehsu
Posts: 6
Joined: Fri Jul 07, 2023 6:26 pm

how to dynamically set QIBM_CGI_LIBRARY_LIST in APACHE?

Post by gracehsu »

Hello;
My client has their system set up so that each of THEIR clients have their own data library list. I was hoping to make it so that the URL tells our system how to figure out the correct library list? I saw that you can re-set environmental variable, like QIBM_CGI_LIBRARY_LIST.

So I'm hoping to do this:
if (fakeurl.com/foo/(pgm) then QIBM_CGI_LIBRARY_LIST = "FOO;PROGRAMLIBS;"
if (fakeurl.com/bar/(pgm) then QIBM_CGI_LIBRARY_LIST = "BAR;PROGRAMLIBS"
etc.

I had it working for a hot second, then it stopped, and I have no idea what I'm doing wrong.
#----
#-- default library list goes to demo/UAT/sales
#----
SetEnv QIBM_CGI_LIBRARY_LIST "QTEMP;DEMO;PROGRAMLIBS;"

#---- note: change setEnvIf to setEnvIfNoCase when this works
SetEnvIf Request_URI "/foo/" QIBM_CGI_LIBRARY_LIST="FOO;QTEMP;PROGRAMLIBS;"
SetEnvIf Request_URI "/bar/" QIBM_CGI_LIBRARY_LIST="BAR;QTEMP;PROGRAMLIBS;"
Scott Klement
Site Admin
Posts: 653
Joined: Sun Jul 04, 2021 5:12 am

Re: how to dynamically set QIBM_CGI_LIBRARY_LIST in APACHE?

Post by Scott Klement »

Code: Select all

SetEnv QIBM_CGI_LIBRARY_LIST "QTEMP;DEMO;PROGRAMLIBS"
<Location /foo/pgm>
  SetEnv QIBM_CGI_LIBRARY_LIST "FOO;PROGRAMLIBS"
</Location>
<Location /otherfoo/otherpgm>
  SetEnv QIBM_CGI_LIBRARY_LIST "OTHERFOO;PROGRAMLIBS"
</Location>
gracehsu
Posts: 6
Joined: Fri Jul 07, 2023 6:26 pm

Re: how to dynamically set QIBM_CGI_LIBRARY_LIST in APACHE?

Post by gracehsu »

Thank You! omg; I wasn't even CLOSE to the solution.
gracehsu
Posts: 6
Joined: Fri Jul 07, 2023 6:26 pm

Re: how to dynamically set QIBM_CGI_LIBRARY_LIST in APACHE?

Post by gracehsu »

A follow up question; would the location directive also work if the domain is entirely different?
For example, if we have the two clients foo and otherfoo, but also client Bar that wants the website to be seen at www.bar.com, can I do this:

SetEnv QIBM_CGI_LIBRARY_LIST "QTEMP;DEMO;PROGRAMLIBS"
<Location /foo/pgm>
SetEnv QIBM_CGI_LIBRARY_LIST "FOO;PROGRAMLIBS"
</Location>
<Location /otherfoo/otherpgm>
SetEnv QIBM_CGI_LIBRARY_LIST "OTHERFOO;PROGRAMLIBS"
</Location>
<Location www.bar.com>
SetEnv QIBM_CGI_LIBRARY_LIST "BAR;PROGRAMLIBS"
</Location>
Scott Klement
Site Admin
Posts: 653
Joined: Sun Jul 04, 2021 5:12 am

Re: how to dynamically set QIBM_CGI_LIBRARY_LIST in APACHE?

Post by Scott Klement »

No, you can't use <Location> to match the hostname. For that, you'll want to use Name Based Virtual Hosts...

Code: Select all


# This first-listed virtual host is also the default for port 80.
# change the :80 to the proper port if needed.
<VirtualHost *:80>
    ServerName www.foo.com
    ServerAlias foo.com 
    SetEnv QIBM_CGI_LIBRARY_LIST "QTEMP;DEMO;PROGRAMLIBS"
    <Location /foo/pgm>
      SetEnv QIBM_CGI_LIBRARY_LIST "FOO;PROGRAMLIBS"
    </Location>
    <Location /otherfoo/otherpgm>
      SetEnv QIBM_CGI_LIBRARY_LIST "OTHERFOO;PROGRAMLIBS"
    </Location>    
    # potentially other <Directory>, <Location>, etc directives here that apply to the default config
</VirtualHost>

<VirtualHost *:80>
    ServerName www.bar.com
    SetEnv QIBM_CGI_LIBRARY_LIST "BAR;PROGRAMLIBS"
    # potentially <Directory>, <Location> directives here that only apply to www.bar.com
</VirtualHost>
gracehsu
Posts: 6
Joined: Fri Jul 07, 2023 6:26 pm

Re: how to dynamically set QIBM_CGI_LIBRARY_LIST in APACHE?

Post by gracehsu »

huh; probably a stupid question; is there a way to set it up so that each of these vHosts creates a different job? For example, right I have a bunch of jobs called E2EP, can i have each vhost spawn a separate job using its own job description & library list?


Work with Active Jobs K70067CX
09/12/23 11:11:52
CPU %: .0 Elapsed time: 00:00:00 Active jobs: 434

Type options, press Enter.
2=Change 3=Hold 4=End 5=Work with 6=Release 7=Display message
8=Work with spooled files 13=Disconnect ...
Current
Opt Subsystem/Job User Type CPU % Function Status
E2EP QTMHHTTP BCH .0 PGM-QZHBMAIN SIGW
E2EP QTMHHTTP BCI .0 PGM-QZSRLOG SIGW
E2EP QTMHHTTP BCI .0 PGM-QZSRLOG SIGW
E2EP QTMHHTTP BCI .0 PGM-QZSRHTTP SIGW
E2EP QTMHHTP1 BCI .0 PGM-QZSRCGI TIMW
Scott Klement
Site Admin
Posts: 653
Joined: Sun Jul 04, 2021 5:12 am

Re: how to dynamically set QIBM_CGI_LIBRARY_LIST in APACHE?

Post by Scott Klement »

I've never tried to make different virtual hosts use different jobs, so I don't know if it is possible.
Post Reply