Support Cloudpulse with WSGI
Change-Id: Ibbe56daa10fa81559bd7b39104f58649be91d3c7
This commit is contained in:
@@ -9,12 +9,16 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import eventlet
|
||||
eventlet.monkey_patch()
|
||||
|
||||
from oslo_config import cfg
|
||||
import pecan
|
||||
import sys
|
||||
|
||||
from cloudpulse.api import auth
|
||||
from cloudpulse.api import config as api_config
|
||||
from cloudpulse.api import hooks
|
||||
from cloudpulse.api import middleware
|
||||
from cloudpulse.common.timerthread import cpulseTimer
|
||||
from cloudpulse.common.timerthread import timerfunc
|
||||
@@ -63,11 +67,24 @@ def get_pecan_config():
|
||||
|
||||
|
||||
def setup_app(config=None):
|
||||
# It is recomended to run cloudpulse with the config file
|
||||
# However with wsgi the default config file will be read from
|
||||
# /docker/cloudpulse/cloudpulse.conf
|
||||
if len(sys.argv) == 1:
|
||||
cfg.CONF(["--config-file", "/docker/cloudpulse/cloudpulse.conf"],
|
||||
project='cloudpulse')
|
||||
|
||||
if not config:
|
||||
config = get_pecan_config()
|
||||
|
||||
app_conf = dict(config.app)
|
||||
|
||||
app_conf["hooks"] = [
|
||||
hooks.ContextHook(),
|
||||
hooks.RPCHook(),
|
||||
hooks.NoExceptionTracebackHook(),
|
||||
]
|
||||
|
||||
app = pecan.make_app(
|
||||
app_conf.pop('root'),
|
||||
logging=getattr(config, 'logging', {}),
|
||||
|
||||
Reference in New Issue
Block a user