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

Variables source configuration #206

Merged
merged 5 commits into from
Jul 22, 2022
Merged

Variables source configuration #206

merged 5 commits into from
Jul 22, 2022

Conversation

icepuma
Copy link
Member

@icepuma icepuma commented Jul 19, 2022

Goal: Add variables to context via different sources.

New value in the config (optional):

variables_source: 
  - "dns+txt://comtrya.icepuma.dev"

Supported protocols:

  • dns+txt://comtrya.icepuma.dev -> DNS TXT records with content "KEY=VALUE"
  • file+toml:///path/to/file.toml
  • file+yaml:///path/to/file.yaml

Using an URI makes it easy to extend :)

@icepuma icepuma self-assigned this Jul 19, 2022
@icepuma icepuma requested a review from rawkode July 19, 2022 00:23
@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2022

Codecov Report

Merging #206 (757ca37) into main (f4f733d) will decrease coverage by 0.66%.
The diff coverage is 34.48%.

@@            Coverage Diff             @@
##             main     #206      +/-   ##
==========================================
- Coverage   47.65%   46.98%   -0.67%     
==========================================
  Files          64       67       +3     
  Lines        2044     2088      +44     
==========================================
+ Hits          974      981       +7     
- Misses       1070     1107      +37     
Impacted Files Coverage Δ
lib/src/config/mod.rs 0.00% <ø> (ø)
lib/src/contexts/variables_source/dns.rs 0.00% <0.00%> (ø)
lib/src/contexts/variables_source/file.rs 0.00% <0.00%> (ø)
lib/src/contexts/variables_source/mod.rs 36.84% <36.84%> (ø)
lib/src/contexts/mod.rs 77.33% <40.00%> (-3.23%) ⬇️
lib/src/actions/file/link.rs 92.85% <100.00%> (-0.15%) ⬇️
lib/src/contexts/env.rs 100.00% <100.00%> (ø)
lib/src/contexts/os.rs 96.77% <100.00%> (ø)
lib/src/contexts/user.rs 100.00% <100.00%> (ø)
lib/src/contexts/variables.rs 100.00% <100.00%> (+14.28%) ⬆️

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 f4f733d...757ca37. Read the comment docs.

- multiple values are supported
- variables are unique
  - the last variables source wins
- currently supported:
  - dns+txt://doma.in TXT records via DNS with "KEY=VALUE" content
  - file+toml:///home/icepuma/file.toml
  - file+yaml:///home/icepuma/file.yaml
- cargo fmt + clippy + nextest
@icepuma
Copy link
Member Author

icepuma commented Jul 20, 2022

@rawkode anything you want me to change here or is the feature fine for you?

Copy link
Member

@rawkode rawkode left a comment

Choose a reason for hiding this comment

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

The only change is the public API key in the config, everything else can be modified later.

examples/Comtrya.yaml Outdated Show resolved Hide resolved
lib/src/contexts/variables_source/dns.rs Outdated Show resolved Hide resolved
@icepuma
Copy link
Member Author

icepuma commented Jul 20, 2022

Feel free to merge, if you're happy with the changes 💪

@rawkode rawkode merged commit 4890a9b into comtrya:main Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants