4 |
|
from optparse import OptionParser |
5 |
|
import DLFCN |
6 |
|
sys.setdlopenflags(DLFCN.RTLD_GLOBAL+DLFCN.RTLD_LAZY) |
7 |
< |
from Applications import iov,globaltag,serviceMap |
7 |
> |
from Applications import iovInspect, iovExport, payload, globaltag,serviceMap |
8 |
> |
from Common import config |
9 |
> |
from pluginCondDBPyInterface import * |
10 |
> |
|
11 |
|
class Root(object): |
12 |
|
@cherrypy.expose |
13 |
|
def index(self): |
19 |
|
def __init__(self): |
20 |
|
self.__hostname='localhost' |
21 |
|
self.__port=6789 |
22 |
+ |
self.__configfile='application.conf' |
23 |
|
|
24 |
|
def start (self): |
25 |
|
"""Start server |
29 |
|
help="port default 6789") |
30 |
|
parser.add_option("--hostname",action="store",dest="hostname", |
31 |
|
help="hostname default localhost") |
32 |
+ |
parser.add_option("--configfile",action="store",dest="configfile", |
33 |
+ |
help="configuration file default application.conf") |
34 |
|
(options, args) = parser.parse_args() |
35 |
|
if options.hostname: |
36 |
|
self.__hostname=options.hostname.strip(' ') |
37 |
|
if options.port: |
38 |
|
self.__port=int(options.port) |
39 |
+ |
#if options.configfile: |
40 |
+ |
# self.__configfile = options.configfile.strip(' ') |
41 |
|
|
42 |
|
serverconfig={'global':{'server.socket_host':self.__hostname,'server.socket_port':self.__port,'server.environment':'production'}} |
43 |
|
cherrypy.config.update(serverconfig) |
44 |
|
cherrypy.tree.mount(Root(),script_name='/') |
45 |
|
currentdir=os.path.dirname(os.path.abspath(__file__)) |
46 |
|
appconfigfile=os.path.join(currentdir,'config','application.conf') |
47 |
< |
#print 'appconfigfile',appconfigfile |
48 |
< |
cherrypy.tree.mount(iov.IOV(appconfigfile),script_name='/iov') |
47 |
> |
|
48 |
> |
# here for the time being |
49 |
> |
self.__config=config.Config() |
50 |
> |
self.__config.from_ini(appconfigfile) |
51 |
> |
self.__authpath=self.__config.common.auth_path |
52 |
> |
os.environ["CORAL_AUTH_PATH"] = self.__authpath |
53 |
> |
print "auth path ", os.environ["CORAL_AUTH_PATH"] |
54 |
> |
# this one shall be alive all the time... |
55 |
> |
self.__cmsframe = FWIncantation |
56 |
> |
|
57 |
> |
cherrypy.tree.mount(iovInspect.IOV(appconfigfile),script_name='/iov') |
58 |
> |
cherrypy.tree.mount(iovExport.IOV(appconfigfile),script_name='/exportIov') |
59 |
|
detconfigfile=os.path.join(currentdir,'config','detector.conf') |
60 |
|
#print 'detconfigfile',detconfigfile |
61 |
|
cherrypy.tree.mount(serviceMap.serviceMap(detconfigfile),script_name='/serviceMap') |