Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

feat: support config from cli args and config file #61

Merged
merged 8 commits into from
Mar 26, 2021

Conversation

AnvarGazizovTH
Copy link
Contributor

@AnvarGazizovTH AnvarGazizovTH commented Dec 16, 2020

Description

Add ability to use file for config as well as command line arguments.

To use specify a config file use the --config-file cli argument to pass in the relative path of the file.

To pass in any specific config parameter as a command line argument use the parameter name as a cli argument.
ex. commit-watch --github-token password123

If config parameters are present from multiple sources they are used in the following order:

  1. Configs passed in as cli args
  2. Configs from a config file
  3. Environment variable configs

Related Issues

Checklist

  • This PR has sufficient documentation.
  • This PR has sufficient test coverage.
  • This PR title satisfies semantic convention.

@codecov
Copy link

codecov bot commented Dec 16, 2020

Codecov Report

Merging #61 (a358be9) into master (2f27d7a) will increase coverage by 3.12%.
The diff coverage is 96.87%.

@@            Coverage Diff             @@
##           master      #61      +/-   ##
==========================================
+ Coverage   75.15%   78.28%   +3.12%     
==========================================
  Files          11       13       +2     
  Lines         157      175      +18     
==========================================
+ Hits          118      137      +19     
+ Misses         39       38       -1     

@noahnu noahnu self-assigned this Dec 16, 2020
src/getConfig.js Outdated Show resolved Hide resolved
src/parseConfigFile.js Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/getConfig.js Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@noahnu
Copy link
Contributor

noahnu commented Feb 2, 2021

@AnvarGazizovTH Left some comments. You'll also want to rebase on master.

@WulffHunter WulffHunter reopened this Mar 25, 2021

1. Configs passed in as cli args
2. Configs from a config file
3. Environment variable configs
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if env vars should take precedence over a config file? Not 100% sure. How do other tools handle this?

Copy link
Contributor

Choose a reason for hiding this comment

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

@WulffHunter WulffHunter merged commit 39a6549 into master Mar 26, 2021
@WulffHunter WulffHunter deleted the add-config-through-cli-or-file branch March 26, 2021 21:37
@noahnu
Copy link
Contributor

noahnu commented Mar 26, 2021

@all-contributors add @WulffHunter for code

@allcontributors
Copy link
Contributor

@noahnu

I've put up a pull request to add @WulffHunter! 🎉

@tophat-opensource-bot
Copy link
Collaborator

🎉 This PR is included in version 0.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for config js file and cli args
4 participants