Skip to content

Commit

Permalink
added runtime config generation from environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzo committed Nov 30, 2018
1 parent 1e2a9b5 commit 33803af
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ ENV ASPNETCORE_ENVIRONMENT=Production \
LIGET_LOG_LEVEL=Information \
LIGET_LOG_BACKEND=console \
LIGET_LOG_GELF_PORT=12201 \
LIGET_LOG_GELF_SOURCE=liget
LIGET_LOG_GELF_SOURCE=liget \
LIGET_GC_CONCURRENT=true \
LIGET_GC_SERVER=true \
LIGET_THREAD_POOL_MIN=16 \
LIGET_THREAD_POOL_MAX=32

COPY /src/LiGet/bin/Release/netcoreapp2.1/publish/ /app

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ Everything can be configured with environment variables:

#### Runtime

*TODO: implement as was in liget v0*

Every dotnet Core application has `.runtimeconfig.json`, which can configure garbage collector.
You may want to set following:
* `LIGET_GC_CONCURRENT` - by default `true`
Expand Down
10 changes: 10 additions & 0 deletions docker-scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ fi

echo "LiGet configuration generated:"
cat $config_json

runtime_config=/app/LiGet.runtimeconfig.json

cat $runtime_config | jq --arg cfg ${LIGET_GC_CONCURRENT} '. | .configProperties."System.GC.Concurrent" = ($cfg == "true")' | sponge $runtime_config
cat $runtime_config | jq --arg cfg ${LIGET_GC_SERVER} '. | .configProperties."System.GC.Server" = ($cfg == "true")' | sponge $runtime_config
cat $runtime_config | jq --arg cfg ${LIGET_THREAD_POOL_MIN} '. | .configProperties."System.Threading.ThreadPool.MinThreads" = ($cfg | tonumber)' | sponge $runtime_config
cat $runtime_config | jq --arg cfg ${LIGET_THREAD_POOL_MAX} '. | .configProperties."System.Threading.ThreadPool.MaxThreads" = ($cfg | tonumber)' | sponge $runtime_config

echo "LiGet runtime configuration generated:"
cat $runtime_config

0 comments on commit 33803af

Please sign in to comment.