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

feat: Introduce top-level config package #389

Merged
merged 5 commits into from
Jun 29, 2022

Conversation

orpheuslummis
Copy link
Contributor

@orpheuslummis orpheuslummis commented May 3, 2022

Introducing a top-level config package in which a Config struct provides DefraDB's configuration, providing facilities such as a documented YAML file, ...

Some goals of this are:

  • top-level clear configuration
  • allow configuration via env. variables, CLI flags, and config file
  • extensible

I recommend starting a review with the config package documentation https://github.com/sourcenetwork/defradb/pull/389/files#diff-fe44f09c4d5977b5f5eaea29170b6a0748819c9d02271746a20d81a5f3efca17R11

Future extensions of this will be configuration for TLS, instrumentation, CORS, etc.

Feedback and discussion is welcome.

Note that the in-repo CLI documentation will be updated as part of the CLI overhaul PR that follows this one.

@orpheuslummis orpheuslummis added the refactor This issue specific to or requires *notable* refactoring of existing codebases and components label May 3, 2022
@orpheuslummis orpheuslummis added this to the DefraDB v0.3 milestone May 3, 2022
@orpheuslummis orpheuslummis self-assigned this May 3, 2022
@codecov
Copy link

codecov bot commented May 3, 2022

Codecov Report

Merging #389 (77de77c) into develop (3957381) will increase coverage by 0.28%.
The diff coverage is 68.10%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #389      +/-   ##
===========================================
+ Coverage    56.58%   56.87%   +0.28%     
===========================================
  Files          121      124       +3     
  Lines        14082    14351     +269     
===========================================
+ Hits          7969     8162     +193     
- Misses        5421     5475      +54     
- Partials       692      714      +22     
Impacted Files Coverage Δ
logging/config.go 76.56% <ø> (ø)
node/node.go 64.46% <33.33%> (-1.67%) ⬇️
node/config.go 59.61% <40.90%> (ø)
config/rootdir.go 60.52% <60.52%> (ø)
config/config.go 72.64% <72.64%> (ø)
config/configfile.go 75.00% <75.00%> (ø)

@source-devs

This comment was marked as off-topic.

@orpheuslummis orpheuslummis changed the title refactor: introduce top-level config package refactor: Introduce top-level config package May 3, 2022
@source-devs

This comment was marked as off-topic.

@source-devs

This comment was marked as off-topic.

@orpheuslummis orpheuslummis changed the title refactor: Introduce top-level config package feat: Introduce top-level config package May 6, 2022
@source-devs

This comment was marked as off-topic.

@orpheuslummis
Copy link
Contributor Author

also closes #347

@source-devs

This comment was marked as off-topic.

@jsimnz jsimnz added feature New feature or request and removed refactor This issue specific to or requires *notable* refactoring of existing codebases and components labels May 6, 2022
@source-devs

This comment was marked as off-topic.

@source-devs

This comment was marked as off-topic.

@orpheuslummis orpheuslummis added the action/no-benchmark Skips the action that runs the benchmark. label May 7, 2022
@orpheuslummis orpheuslummis marked this pull request as ready for review May 10, 2022 15:36
Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

Was really nice to review - I really like the changes, I dont think I have any major comments (mostly ticket requests/questions/documentation). Approved assuming you respond to my comments before merge.

config/config.go Outdated Show resolved Hide resolved
config/config.go Show resolved Hide resolved
config/config.go Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/config_test.go Show resolved Hide resolved
config/rootdir.go Show resolved Hide resolved
config/rootdir.go Outdated Show resolved Hide resolved
node/config.go Show resolved Hide resolved
node/config.go Show resolved Hide resolved
cli/defradb/cmd/root.go Outdated Show resolved Hide resolved
cli/defradb/cmd/root.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
cli/defradb/cmd/init.go Outdated Show resolved Hide resolved
node/config.go Show resolved Hide resolved
cli/defradb/cmd/root.go Outdated Show resolved Hide resolved
@orpheuslummis
Copy link
Contributor Author

Closes #469

@orpheuslummis orpheuslummis linked an issue May 24, 2022 that may be closed by this pull request
@orpheuslummis
Copy link
Contributor Author

Closes #346

@orpheuslummis orpheuslummis linked an issue May 24, 2022 that may be closed by this pull request
Copy link
Member

@jsimnz jsimnz left a comment

Choose a reason for hiding this comment

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

Sorry for the delay on this, some minor changes/suggestions

cli/defradb/cmd/init.go Outdated Show resolved Hide resolved
cli/defradb/cmd/init.go Outdated Show resolved Hide resolved
cli/defradb/cmd/init.go Outdated Show resolved Hide resolved
Copy link
Member

@shahzadlone shahzadlone left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

LGTM!

@orpheuslummis
Copy link
Contributor Author

Sorry for having just one commit on this one, I didn't know any better

Main difference from previous iteration is the way CLI flags are handled solving a flag precedence issue

Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

I skimmed through again, looks good with a couple of minor comments I would prefer sorted pre-merge. Thanks again for cleaning this up!

cli/serverdump.go Outdated Show resolved Hide resolved
config/config.go Show resolved Hide resolved
Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

Approving provided you integrate the suggested change :)

node/config.go Outdated Show resolved Hide resolved
@orpheuslummis orpheuslummis merged commit b16bf3a into develop Jun 29, 2022
@orpheuslummis orpheuslummis deleted the orpheus/refactor/config branch June 29, 2022 17:40
This was referenced Jun 29, 2022
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/no-benchmark Skips the action that runs the benchmark. feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Top-level config package Configuration overhaul
6 participants