Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#175059122] Centralise config read #89

Merged
merged 12 commits into from
Oct 6, 2020
Merged

[#175059122] Centralise config read #89

merged 12 commits into from
Oct 6, 2020

Conversation

balanza
Copy link
Contributor

@balanza balanza commented Sep 30, 2020

This PR introduces the utils/config module which aims to be the unique interface for application configuration.

Every place in which the application used to directly access env variable has been refactored to use this module instead.

@balanza balanza requested a review from gunzip September 30, 2020 15:35
@pagopa-github-bot
Copy link
Contributor

pagopa-github-bot commented Sep 30, 2020

Affected stories

  • ⚙️ #175059122: Centralizzare la lettura delle variabili di ambiente in io-functions-admin

Generated by 🚫 dangerJS

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2020

Codecov Report

Merging #89 into master will decrease coverage by 0.09%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #89      +/-   ##
==========================================
- Coverage   83.94%   83.85%   -0.10%     
==========================================
  Files          44       45       +1     
  Lines        1489     1505      +16     
  Branches      124      125       +1     
==========================================
+ Hits         1250     1262      +12     
- Misses        234      238       +4     
  Partials        5        5              
Impacted Files Coverage Δ
utils/config.ts 75.00% <75.00%> (ø)

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 77067d9...59d304a. Read the comment docs.

@balanza balanza mentioned this pull request Oct 1, 2020
@gunzip
Copy link
Contributor

gunzip commented Oct 1, 2020

lgtm, if you handle the FIXMEs we can proceed and merge it

Copy link
Contributor

@AleDore AleDore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Maybe we have to check if there are any case of "optional" env variable, and how we can handle it using this approach.

@gunzip
Copy link
Contributor

gunzip commented Oct 5, 2020

lgtm, why draft ?

Comment on lines 19 to 22
const cosmosDbName = config.COSMOSDB_NAME;

const messagesContainer = cosmosdbClient
.database(cosmosDbName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use directly the config value?

Suggested change
const cosmosDbName = config.COSMOSDB_NAME;
const messagesContainer = cosmosdbClient
.database(cosmosDbName)
const messagesContainer = cosmosdbClient
.database(config.COSMOSDB_NAME)

Copy link
Contributor

@BurnedMarshal BurnedMarshal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, only check if is better variables aliasing instead using directly the values

@balanza balanza marked this pull request as ready for review October 5, 2020 10:56
@gunzip gunzip merged commit 3918cfd into master Oct 6, 2020
@gunzip gunzip deleted the 175059122-config branch October 6, 2020 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants