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

feature: Read config directory from GLAB_CONFIG_DIR #921

Merged
merged 1 commit into from
Dec 2, 2021

Conversation

kampka
Copy link
Contributor

@kampka kampka commented Nov 28, 2021

Description

When working with many different gitlab instances for different
projects, the global config quickly gets cluttered up with
specific settings that do not clean up conveniently. On the other hand,
local configs are to local, restricting the config to one repository
instead of one project or instance that potentially contains many
relevant repositories.
This change introduces a middle ground solution via the GLAB_CONFIG_DIR
environment variable. Setting this variable will allow global
configuration to travel with the project instead of populating the XDG
global config.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)

@codecov
Copy link

codecov bot commented Nov 28, 2021

Codecov Report

Merging #921 (e532797) into trunk (9b44934) will decrease coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            trunk     #921      +/-   ##
==========================================
- Coverage   59.48%   59.48%   -0.01%     
==========================================
  Files          97       97              
  Lines        7603     7607       +4     
==========================================
+ Hits         4523     4525       +2     
- Misses       2679     2680       +1     
- Partials      401      402       +1     
Impacted Files Coverage Δ
internal/config/config_file.go 31.68% <33.33%> (+0.05%) ⬆️
commands/root.go 78.04% <100.00%> (+0.27%) ⬆️

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 9b44934...e532797. Read the comment docs.

Copy link
Collaborator

@zemzale zemzale left a comment

Choose a reason for hiding this comment

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

I actually like this change. There should be some changes to documentation so users know about this.

Also would need approval from @profclems but this LGTM!

@kampka
Copy link
Contributor Author

kampka commented Nov 29, 2021

There should be some changes to documentation so users know about this.

Agreed. I added a comment to the README as I could not find any mentioning of the config files in the documentation at all.

Copy link
Owner

@profclems profclems left a comment

Choose a reason for hiding this comment

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

This is great!

Please add it to the env vars here

glab/commands/root.go

Lines 41 to 60 in 9b44934

GITLAB_TOKEN: an authentication token for API requests. Setting this avoids being
prompted to authenticate and overrides any previously stored credentials.
Can be set in the config with 'glab config set token xxxxxx'
GITLAB_HOST or GL_HOST: specify the url of the gitlab server if self hosted (eg: https://gitlab.example.com). Default is https://gitlab.com.
REMOTE_ALIAS or GIT_REMOTE_URL_VAR: git remote variable or alias that contains the gitlab url.
Can be set in the config with 'glab config set remote_alias origin'
VISUAL, EDITOR (in order of precedence): the editor tool to use for authoring text.
Can be set in the config with 'glab config set editor vim'
BROWSER: the web browser to use for opening links.
Can be set in the config with 'glab config set browser mybrowser'
GLAMOUR_STYLE: environment variable to set your desired markdown renderer style
Available options are (dark|light|notty) or set a custom style
https://github.com/charmbracelet/glamour#styles
NO_PROMPT: set to 1 (true) or 0 (false) to disable and enable prompts respectively

When working with many different gitlab instances for different
projects, the global config quickly gets cluttered up with
specific settings that do not clean up conveniently. On the other hand,
local configs are to local, restricting the config to one repository
instead of one project or instance that potentially contains many
relevant repositories.
This change introduces a middle ground solution via the GLAB_CONFIG_DIR
environment variable. Setting this variable will allow global
configuration to travel with the project instead of populating the XDG
global config.
@kampka
Copy link
Contributor Author

kampka commented Dec 2, 2021

Done.

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.

3 participants