##// END OF EJS Templates
fix(mercurial): fixed httppostargs logic
fix(mercurial): fixed httppostargs logic

File last commit:

r5516:3496180b default
r5606:faa7b2f4 default
Show More
__init__.py
97 lines | 3.7 KiB | text/x-python | PythonLexer
copyrights: updated for 2023
r5088 # Copyright (C) 2016-2023 RhodeCode GmbH
file-store: rename module from upload_store to file_store.
r3453 #
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import os
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516
config: major update for the code to make it be almost fully controllable via env for new docker based installer.
r4823 from rhodecode.config.settings_maker import SettingsMaker
file-store: rename module from upload_store to file_store.
r3453
def _sanitize_settings_and_apply_defaults(settings):
"""
Set defaults, convert to python types and validate settings.
"""
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516 from rhodecode.apps.file_store import config_keys
# translate "legacy" params into new config
settings.pop(config_keys.deprecated_enabled, True)
if config_keys.deprecated_backend in settings:
# if legacy backend key is detected we use "legacy" backward compat setting
settings.pop(config_keys.deprecated_backend)
settings[config_keys.backend_type] = config_keys.backend_legacy_filesystem
if config_keys.deprecated_store_path in settings:
store_path = settings.pop(config_keys.deprecated_store_path)
settings[config_keys.legacy_filesystem_storage_path] = store_path
config: major update for the code to make it be almost fully controllable via env for new docker based installer.
r4823 settings_maker = SettingsMaker(settings)
file-store: rename module from upload_store to file_store.
r3453
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516 default_cache_dir = settings['cache_dir']
default_store_dir = os.path.join(default_cache_dir, 'artifacts_filestore')
# set default backend
settings_maker.make_setting(config_keys.backend_type, config_keys.backend_legacy_filesystem)
# legacy filesystem defaults
settings_maker.make_setting(config_keys.legacy_filesystem_storage_path, default_store_dir, default_when_empty=True, )
file-store: rename module from upload_store to file_store.
r3453
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516 # filesystem defaults
settings_maker.make_setting(config_keys.filesystem_storage_path, default_store_dir, default_when_empty=True,)
settings_maker.make_setting(config_keys.filesystem_shards, 8, parser='int')
# objectstore defaults
settings_maker.make_setting(config_keys.objectstore_url, 'http://s3-minio:9000')
settings_maker.make_setting(config_keys.objectstore_bucket, 'rhodecode-artifacts-filestore')
settings_maker.make_setting(config_keys.objectstore_bucket_shards, 8, parser='int')
settings_maker.make_setting(config_keys.objectstore_region, '')
settings_maker.make_setting(config_keys.objectstore_key, '')
settings_maker.make_setting(config_keys.objectstore_secret, '')
file-store: rename module from upload_store to file_store.
r3453
env-config: use proper ALL keys reconfiguration based on env vars
r4825 settings_maker.env_expand()
file-store: rename module from upload_store to file_store.
r3453
def includeme(config):
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516
application: not use config.scan(), and replace all @add_view decorator into a explicit add_view call for faster app start.
r4610 from rhodecode.apps.file_store.views import FileStoreView
file-store: rename module from upload_store to file_store.
r3453 settings = config.registry.settings
_sanitize_settings_and_apply_defaults(settings)
config.add_route(
name='upload_file',
pattern='/_file_store/upload')
application: not use config.scan(), and replace all @add_view decorator into a explicit add_view call for faster app start.
r4610 config.add_view(
FileStoreView,
attr='upload_file',
route_name='upload_file', request_method='POST', renderer='json_ext')
file-store: rename module from upload_store to file_store.
r3453 config.add_route(
name='download_file',
artifacts: few fixes for handling cases of using sub path to store artifacts....
r4476 pattern='/_file_store/download/{fid:.*}')
application: not use config.scan(), and replace all @add_view decorator into a explicit add_view call for faster app start.
r4610 config.add_view(
FileStoreView,
attr='download_file',
route_name='download_file')
artifacts: expose a special auth-token based artifacts download urls....
r4003 config.add_route(
name='download_file_by_token',
artifacts: few fixes for handling cases of using sub path to store artifacts....
r4476 pattern='/_file_store/token-download/{_auth_token}/{fid:.*}')
application: not use config.scan(), and replace all @add_view decorator into a explicit add_view call for faster app start.
r4610 config.add_view(
FileStoreView,
attr='download_file_by_token',
route_name='download_file_by_token')