Skip to content

Commit

Permalink
feat dynamic_config: migrate to the new config format (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton3 authored Oct 31, 2023
1 parent c7af20e commit 3626c76
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 103 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ compile_commands.json
.cores/
cmake-build-*
Testing/
configs/config_vars.yaml
configs/config_vars.docker.yaml
12 changes: 0 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ if(DEFINED ENV{PREFIX})
set(CMAKE_INSTALL_PREFIX ${PREFIX_PATH})
endif()

set(CONFIG_FALLBACK_PATH
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/${PROJECT_NAME}/dynamic_config_fallback.json")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/configs/config_vars.template.yaml"
"${CMAKE_CURRENT_SOURCE_DIR}/configs/config_vars.yaml"
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/configs/config_vars.docker.template.yaml"
"${CMAKE_CURRENT_SOURCE_DIR}/configs/config_vars.docker.yaml"
)

file(GLOB CONFIGS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/configs/*.yaml ${CMAKE_CURRENT_SOURCE_DIR}/configs/*.json)

install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${PROJECT_NAME})
Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ clean-debug clean-release: clean-%:
.PHONY: dist-clean
dist-clean:
@rm -rf build_*
@rm -f ./configs/config_vars.docker.yaml
@rm -f ./configs/config_vars.yaml
@rm -rf tests/__pycache__/
@rm -rf tests/.pytest_cache/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ is-testing: false
server-port: 8080

dbconnection: 'postgresql://user:password@service-postgres:5432/pg_service_template_db_1'

config-fallback-path: @CONFIG_FALLBACK_PATH@
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ is-testing: false
server-port: 8080

dbconnection: 'postgresql://pg_service_template_user:password@localhost:5432/pg_service_template_db_1'

config-fallback-path: @CONFIG_FALLBACK_PATH@
68 changes: 0 additions & 68 deletions configs/dynamic_config_fallback.json

This file was deleted.

23 changes: 9 additions & 14 deletions configs/static_config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
# yaml

components_manager:
coro_pool:
initial_size: 500 # Preallocate 500 coroutines at startup.
max_size: 1000 # Do not keep more than 1000 preallocated coroutines.

task_processors: # Task processor is an executor for coroutine tasks

main-task-processor: # Make a task processor for CPU-bound couroutine tasks.
worker_threads: $worker-threads # Process tasks in 4 threads.
thread_name: main-worker # OS will show the threads of this task processor with 'main-worker' prefix.

fs-task-processor: # Make a separate task processor for filesystem bound tasks.
thread_name: fs-worker
worker_threads: $worker-fs-threads

default_task_processor: main-task-processor
Expand All @@ -30,13 +22,16 @@ components_manager:
level: $logger-level
overflow_behavior: discard # Drop logs if the system is too busy to write them down.

tracer: # Component that helps to trace execution times and requests in logs.
service-name: pg_service_template # "You know. You all know exactly who I am. Say my name. " (c)
# Dynamic config options. Cache is disabled, updates are disabled.
dynamic-config:
# For most of userver dynamic configs, defaults are used, some are overridden here.
# See userver "dynamic config" docs for what configs exist.
defaults:
HTTP_CLIENT_CONNECTION_POOL_SIZE: 1000
POSTGRES_DEFAULT_COMMAND_CONTROL:
network_timeout_ms: 750
statement_timeout_ms: 500

dynamic-config: # Dynamic config storage options, do nothing
fs-cache-path: ''
dynamic-config-fallbacks: # Load options from file and push them into the dynamic config storage.
fallback-path: $config-fallback-path
testsuite-support: {}

http-client:
Expand Down
2 changes: 1 addition & 1 deletion third_party/userver
Submodule userver updated 684 files

0 comments on commit 3626c76

Please sign in to comment.