-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgq_embedconfig.cgi
More file actions
executable file
·63 lines (46 loc) · 1.71 KB
/
gq_embedconfig.cgi
File metadata and controls
executable file
·63 lines (46 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl
# How to run GQ without a separate configuration file.
### Put contents of genquery_conf.xml after this line:
my $conf = <<'CONF';
<gq_config>
<template_dir>/etc/genquery/templates</template_dir>
<!-- These will be passed directly into templates -->
<template_vars>
<SITE_TITLE>My GenQuery site</SITE_TITLE>
<SITE_BANNER>GenQuery is the Generic Query Generator</SITE_BANNER>
</template_vars>
<!-- Single database connection with all parameters supplied -->
<db_connection id="0">
<db_type>Pg</db_type>
<db_host>dbhost.example.com</db_host>
<db_name>yourdb</db_name>
<db_user>webuser</db_user>
<db_pass>webuser</db_pass>
<db_schema>public</db_schema>
<query_defs>public.query_def</query_defs>
<query_params>public.query_param</query_params>
</db_connection>
<cache_queries>no</cache_queries>
<login_cookies>yes</login_cookies>
<bookmarks_on_links>yes</bookmarks_on_links>
</gq_config>
CONF
### End of configuration. You should not need to edit below this line.
use GenQuery::WebQuery;
use CGI;
use strict; use warnings;
BEGIN { if($ENV{REQUEST_METHOD}){
require CGI::Carp; import CGI::Carp qw(fatalsToBrowser);
} };
#Point GenQuery to the appropriate configuration file.
my $params = { config_file => $conf };
# At this point you can inspect and modify the parameters, in which case you need
# to pass a CGI object to WebQuery->new()
# my $query = new CGI;
# if $query->param('foo') { do something };
# my $cgiapp = GenQuery::WebQuery->new(QUERY => $query, PARAMS => $params);
# or more simply...
my $cgiapp = GenQuery::WebQuery->new(PARAMS => $params);
# Uncomment for debugging:
# $cgiapp->savetofile("/tmp/last_gq_run.out");
$cgiapp->run();