##// END OF EJS Templates
fix(api.url): set default api.url and re-use defaults in ssh wrappers
super-admin -
r5317:688c5949 default
parent child Browse files
Show More
@@ -22,7 +22,6 b' import sys'
22 import fnmatch
22 import fnmatch
23
23
24 import decorator
24 import decorator
25 import typing
26 import venusian
25 import venusian
27 from collections import OrderedDict
26 from collections import OrderedDict
28
27
@@ -45,7 +44,7 b' from rhodecode.model.db import User, Use'
45 log = logging.getLogger(__name__)
44 log = logging.getLogger(__name__)
46
45
47 DEFAULT_RENDERER = 'jsonrpc_renderer'
46 DEFAULT_RENDERER = 'jsonrpc_renderer'
48 DEFAULT_URL = '/_admin/apiv2'
47 DEFAULT_URL = '/_admin/api'
49 SERVICE_API_IDENTIFIER = 'service_'
48 SERVICE_API_IDENTIFIER = 'service_'
50
49
51
50
@@ -26,13 +26,13 b' import logging.config'
26 from paste.gzipper import make_gzip_middleware
26 from paste.gzipper import make_gzip_middleware
27 import pyramid.events
27 import pyramid.events
28 from pyramid.wsgi import wsgiapp
28 from pyramid.wsgi import wsgiapp
29 from pyramid.authorization import ACLAuthorizationPolicy
30 from pyramid.config import Configurator
29 from pyramid.config import Configurator
31 from pyramid.settings import asbool, aslist
30 from pyramid.settings import asbool, aslist
32 from pyramid.httpexceptions import (
31 from pyramid.httpexceptions import (
33 HTTPException, HTTPError, HTTPInternalServerError, HTTPFound, HTTPNotFound)
32 HTTPException, HTTPError, HTTPInternalServerError, HTTPFound, HTTPNotFound)
34 from pyramid.renderers import render_to_response
33 from pyramid.renderers import render_to_response
35
34
35 from rhodecode import api
36 from rhodecode.model import meta
36 from rhodecode.model import meta
37 from rhodecode.config import patches
37 from rhodecode.config import patches
38 from rhodecode.config import utils as config_utils
38 from rhodecode.config import utils as config_utils
@@ -527,7 +527,7 b' def sanitize_settings_and_apply_defaults'
527
527
528 # TODO: johbo: Re-think this, usually the call to config.include
528 # TODO: johbo: Re-think this, usually the call to config.include
529 # should allow to pass in a prefix.
529 # should allow to pass in a prefix.
530 settings_maker.make_setting('rhodecode.api.url', '/_admin/api')
530 settings_maker.make_setting('rhodecode.api.url', api.DEFAULT_URL)
531
531
532 # Sanitize generic settings.
532 # Sanitize generic settings.
533 settings_maker.make_setting('default_encoding', 'UTF-8', parser='list')
533 settings_maker.make_setting('default_encoding', 'UTF-8', parser='list')
@@ -837,7 +837,13 b' def call_service_api(ini_path, payload):'
837 "Please ensure that app.service_api.host and app.service_api.token are "
837 "Please ensure that app.service_api.host and app.service_api.token are "
838 "defined inside of .ini configuration file."
838 "defined inside of .ini configuration file."
839 )
839 )
840 api_url = config.get('app:main', 'rhodecode.api.url')
840 try:
841 api_url = config.get('app:main', 'rhodecode.api.url')
842 except NoOptionError:
843 from rhodecode import api
844 log.debug('Cannot find rhodecode.api.url, setting API URL TO Default value')
845 api_url = api.DEFAULT_URL
846
841 payload.update({
847 payload.update({
842 'id': 'service',
848 'id': 'service',
843 'auth_token': config.get('app:main', 'app.service_api.token')
849 'auth_token': config.get('app:main', 'app.service_api.token')
General Comments 0
You need to be logged in to leave comments. Login now