Changeset 4195 for TI12-security


Ignore:
Timestamp:
12/09/08 17:31:29 (11 years ago)
Author:
pjkersha
Message:

Updated to work with paster or as standalone script

Location:
TI12-security/trunk/python/ndg.security.test/ndg/security/test/attAuthority/wsgi
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/attAuthority/wsgi/site-a.ini

    r4194 r4195  
    11# 
    2 # ndgsecurity - Pylons development environment configuration 
    3 # 
    4 # The %(here)s variable will be replaced with the parent directory of this file 
    5 # 
     2# PasteDeploy ini file for Attribute Authority Unit tests Site A Server 
     3#  
     4# NERC Data Grid Project 
     5#  
     6# P J Kershaw 12/09/08 
     7#  
     8# Copyright (C) 2008 CCLRC & NERC 
     9#  
     10# This software may be distributed under the terms of the Q Public License, 
     11# version 1.0 or later. 
     12 
    613[DEFAULT] 
    7 debug = true 
    8 # Uncomment and replace with the address which should receive any error reports 
    9 #email_to = you@yourdomain.com 
    10 smtp_server = localhost 
    11 error_email_from = paste@localhost 
    1214wsseCfgFilePath = ./wssecurity.cfg 
    1315 
     
    1820 
    1921[app:mainApp] 
    20 #use = egg:ndg.security.test.attAuthority.wsgi.siteAServerApp#app 
    2122paste.app_factory = ndg.security.test.attAuthority.wsgi.siteAServerApp:app_factory 
    22 #full_stack = true 
    23 #cache_dir = %(here)s/data 
    24 #beaker.session.key = ndgsecurity 
    25 #beaker.session.secret = somesecret 
    2623 
    2724# Chain of SOAP Middleware filters 
     
    4744writeResponse = True 
    4845 
    49 # If you'd like to fine-tune the individual locations of the cache data dirs 
    50 # for the Cache data, or the Session saves, un-comment the desired settings 
    51 # here: 
    52 #beaker.cache.data_dir = %(here)s/data/cache 
    53 #beaker.session.data_dir = %(here)s/data/sessions 
    54  
    55 # WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 
    56 # Debug mode will enable the interactive debugging tool, allowing ANYONE to 
    57 # execute malicious code after an exception is raised. 
    58 #set debug = false 
    59  
    60  
    6146# Logging configuration 
    6247[loggers] 
    63 keys = root, ndgsecurity, ndg 
     48keys = root, ndg 
    6449 
    6550[handlers] 
     
    7257level = INFO 
    7358handlers = console 
    74  
    75 [logger_ndgsecurity] 
    76 level = DEBUG 
    77 handlers = 
    78 qualname = ndgsecurity 
    7959 
    8060[logger_ndg] 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/attAuthority/wsgi/siteAServerApp.py

    r4194 r4195  
    22import os 
    33 
    4 from pylons import config 
    5  
    6 def makeApp(global_conf, app_conf): 
    7     """Configure the Pylons environment via the ``pylons.config`` 
    8     object 
    9     """ 
    10     # Pylons paths 
    11     root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
    12     paths = dict(root=root) 
    13  
    14     # Initialize config with the basic options 
    15     config.init_app(global_conf, app_conf) 
    16      
    17     return app() 
    18  
    19 def helloApp(environ, start_response): 
     4def infoApp(environ, start_response): 
    205    start_response('200 OK', [('Content-type', 'text/plain')]) 
    21     return "Hello" 
     6    return "NDG Security Attribute Authority Unit Tests: Site A Server" 
    227 
    238def app_factory(global_config, **local_conf): 
    24     return helloApp 
     9    return infoApp 
    2510 
    26 from paste.deploy import loadapp 
    27 cfgFilePath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 
    28                            'site-a.ini') 
     11 
     12# Initialize environment for unit tests 
    2913if 'NDGSEC_AACLNT_UNITTEST_DIR' not in os.environ: 
    3014    os.environ['NDGSEC_AACLNT_UNITTEST_DIR'] = \ 
     
    4630    os.environ['NDGSEC_DIR'] = os.path.dirname(eggConfigDir) 
    4731 
    48 def wsgiApp(): 
    49     return loadapp('config:%s' % cfgFilePath) 
     32# To start the Site A Attribute Authority run  
     33# $ paster serve site-a.ini or run this file as a script 
     34# $ ./siteAServerApp.py [port #] 
     35if __name__ == '__main__': 
     36    import sys 
     37    if len(sys.argv) > 0: 
     38        port = int(sys.argv[1]) 
     39    else: 
     40        port = 5000 
     41         
     42    cfgFilePath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 
     43                                'site-a.ini') 
     44         
     45    from paste.httpserver import serve 
     46    from paste.deploy import loadapp 
    5047 
    51 if __name__ == '__main__': 
    52     from paste.httpserver import serve 
    53     app = wsgiApp() 
    54     serve(app)#, host='0.0.0.0', port=8082) 
     48    app = loadapp('config:%s' % cfgFilePath) 
     49    serve(app, host='0.0.0.0', port=port) 
Note: See TracChangeset for help on using the changeset viewer.