G-Node / tonic

Framework for building services that interact with GIN
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

Configuration support and common logging #17

Closed achilleas-k closed 4 years ago

achilleas-k commented 4 years ago

This PR makes the configuration values for each service mandatory. A concrete instance of tonic.Config is required when initialising a new service through the tonic.New() function. Reading configuration values either from a file or from env vars (or however else) is the responsibility of each service using the library.

Closes #7.

The PR also sets a logger member for each service struct (tonic service, worker queue, and web service). Each New() function defines its own logger when creating the service. This can be replaced using the SetLogger() function. When creating a tonic service or replacing its logger, it shares its logger with both the worker queue and the web service.

codecov[bot] commented 4 years ago

Codecov Report

Merging #17 into master will decrease coverage by 0.37%. The diff coverage is 34.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #17      +/-   ##
==========================================
- Coverage   31.11%   30.74%   -0.38%     
==========================================
  Files           9        9              
  Lines         527      540      +13     
==========================================
+ Hits          164      166       +2     
- Misses        350      360      +10     
- Partials       13       14       +1     
Impacted Files Coverage Δ
tonic/routes.go 7.84% <0.00%> (ø)
utonics/example/main.go 0.00% <0.00%> (ø)
utonics/labproject/main.go 0.00% <0.00%> (ø)
tonic/service.go 54.79% <51.51%> (-8.98%) :arrow_down:
tonic/web/web.go 52.38% <85.71%> (+20.71%) :arrow_up:
tonic/worker/worker.go 92.72% <85.71%> (+0.41%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0d72dfe...ba64a9c. Read the comment docs.