fix(api.url): set default api.url and re-use defaults in ssh wrappers
This commit is contained in:
parent
2f216c3acf
commit
8de3597958
3 changed files with 10 additions and 5 deletions
|
|
@ -22,7 +22,6 @@ import sys
|
|||
import fnmatch
|
||||
|
||||
import decorator
|
||||
import typing
|
||||
import venusian
|
||||
from collections import OrderedDict
|
||||
|
||||
|
|
@ -45,7 +44,7 @@ from rhodecode.model.db import User, UserApiKeys
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_RENDERER = 'jsonrpc_renderer'
|
||||
DEFAULT_URL = '/_admin/apiv2'
|
||||
DEFAULT_URL = '/_admin/api'
|
||||
SERVICE_API_IDENTIFIER = 'service_'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ import logging.config
|
|||
from paste.gzipper import make_gzip_middleware
|
||||
import pyramid.events
|
||||
from pyramid.wsgi import wsgiapp
|
||||
from pyramid.authorization import ACLAuthorizationPolicy
|
||||
from pyramid.config import Configurator
|
||||
from pyramid.settings import asbool, aslist
|
||||
from pyramid.httpexceptions import (
|
||||
HTTPException, HTTPError, HTTPInternalServerError, HTTPFound, HTTPNotFound)
|
||||
from pyramid.renderers import render_to_response
|
||||
|
||||
from rhodecode import api
|
||||
from rhodecode.model import meta
|
||||
from rhodecode.config import patches
|
||||
from rhodecode.config import utils as config_utils
|
||||
|
|
@ -527,7 +527,7 @@ def sanitize_settings_and_apply_defaults(global_config, settings):
|
|||
|
||||
# TODO: johbo: Re-think this, usually the call to config.include
|
||||
# should allow to pass in a prefix.
|
||||
settings_maker.make_setting('rhodecode.api.url', '/_admin/api')
|
||||
settings_maker.make_setting('rhodecode.api.url', api.DEFAULT_URL)
|
||||
|
||||
# Sanitize generic settings.
|
||||
settings_maker.make_setting('default_encoding', 'UTF-8', parser='list')
|
||||
|
|
|
|||
|
|
@ -837,7 +837,13 @@ def call_service_api(ini_path, payload):
|
|||
"Please ensure that app.service_api.host and app.service_api.token are "
|
||||
"defined inside of .ini configuration file."
|
||||
)
|
||||
api_url = config.get('app:main', 'rhodecode.api.url')
|
||||
try:
|
||||
api_url = config.get('app:main', 'rhodecode.api.url')
|
||||
except NoOptionError:
|
||||
from rhodecode import api
|
||||
log.debug('Cannot find rhodecode.api.url, setting API URL TO Default value')
|
||||
api_url = api.DEFAULT_URL
|
||||
|
||||
payload.update({
|
||||
'id': 'service',
|
||||
'auth_token': config.get('app:main', 'app.service_api.token')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue