-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Several gitlab providers #151
Comments
😆 I knew this day would come !! @albfan This isn't currently supported by lab, but its actually something I've been thinking about a lot lately, but my only use case was for testing. Here's what I've been kicking around, LMK what you think In the case you want to manually switch (add on first use) to the "default" profile.
Ideally though lab does the magic to
Config wise that essentially means making |
Side note: idea with |
So it would be like:
The I think that we can add an So this will be the config:
This will be the commands:
Maybe an option to choose profile based on configured profile or based on remote name is expected. It would live in
Let me know if you find gaps in this analysis |
Hi, |
@fauust That would work (don't know if lab reads on repo directory before look for global file. But as you create an access token for every gitlab provider, seems a boilerplate workaround. I'm ok with workarounds, @zaquestion is that an option? |
@albfan, indeed it's true, lab will look in the current directory for a config first before looking for the global one. Thinking about it more, that should probably be the current git dir so it will work anywhere in the repo |
Nice! |
I like the way how hub mitigates this problem with GitHub's enterprise version by using multiple hosts within the config. IMO, it'd be super cool to have lab autodetect the host from the list of hosts in configuration and use it based on the the default remote of current repo. |
Ideally, |
Just to get hopes up -- Im facing this now as well, so I'll probably try to tackle this soon. |
I would like to suggest implementing something similar to git's config include logic. This is how I use it for git config (and it would be awesome to replicate for lab):
To achieve different configurations, I have a main git config file ( [user]
name = Jacques Dafflon
email = jacques@dafflon.tech
[includeIf "gitdir:~/code/<company_name>/*"]
path = ~/code/<company_name>/.gitconfig
[includeIf "gitdir:~/code/<some FOSS with custom hosting>/*"]
path = ~/code/<some FOSS with custom hosting>/.gitconfig Then in [user]
name = Jacques Dafflon
email = jacques@company_name.com and similarly for
Hub uses something similar directly in the Lab is a really cool project and I would love to see this feature added. |
Semi-helpful: for now, I'm using different files in the lab-use () {
cp ~/.config/lab.$1.hcl ~/.config/lab.hcl
} so I'll simply do What could work okay too is if lab would traverse the directory root upwards until it finds a lab.hcl file. |
@reneroth I would argue that traversing the directory root is expensive. But more importantly this can result in unexpected behavior where if I delete a file or move a folder around, the config might change without warning because the path to the root has changed. I prefer the ability to define where the various config files are in a more declarative and explicit way, and keep everything encapsulated. |
So this follows what @albfan suggested above but simplifies the command-line interface by not requiring to manually specify the profile. For me it's not uncommon to have a single git clone with multiple remotes with different URL/sources.
The first two are clones handled by different users, Given the above, wouldn't matching the profile based on the URL be sufficient? For
And then have:
In this case you'd only need something like:
Notice the lack of This is identical to what git already does under the hood when looking for which SSH credentials to use and what pass-git-helper uses to match credentials when using HTTPS.. At this moment I can't think of a situation that isn't covered by this proposal. PS: On a slight tangent, with security in mind, I might find it useful to store tokens in someplace encrypted such as pass and use a hook-like mechanism to retrieve it (such as in pass-git-helper). As such having tokens in plaintext on disk or in a |
First of all, Thanks for this great tool (: |
@omerpr23 Yeah I still want to support it, implementation is in the air currently, and since the design here has converged away from a That said, I created a placeholder issue at #325 and would love to move/continue discussion there and field any suggestions on how to properly home the functionality in lab. |
Is anyone working on this? |
I have repos in gitlab.com and gitlab.gnome.org.
I take a look into
~/.config/lab.hcl
and seems there's only a core section, with host, user and tokenIs it possible to manage several gitlab providers?
The text was updated successfully, but these errors were encountered: