Open charliemaiors opened 5 years ago
I'm gonna share how I have multiple account support with lab. Since lab can read the token from env, this can be archived via direnv.
For example, you can have an .envrc
file in one folder for your own project, that use master gitlab, and another one for your company projects that use on-premise.
├── company
│ ├── .envrc
│ └── project-a
└── my-project
└── .envrc
3 directories, 2 files
Content of .envrc
file:
export LAB_CORE_HOST="https://git.garena.com"
export LAB_CORE_TOKEN="xxxx"
export LAB_CORE_USER="xxx"
Lab can support this by checking for its config file on every folder from the working dir up to root, though.
Yeah this seems like the way to do it, at least its likely to be the easiest to implement. I'm getting married this week, but I'll see if I can find some time to implement searching parent directories for the config sometime next week.
Oh, congratulation.
Oh, congratulations all the best :) I will use the configuration suggested by @letientai299
I now use direnv
as suggested by @letientai299 as well. Together with https://github.com/motemen/ghq this is a good fit as ghq
automatically clones repositories into folders named like github.com/ORG/PROJECT, so e.g. putting an .envrc
file on the ORG level is a perfect match for me :-)
Thanks for all the patience friends!
I've made the same! 😍
This worth to be inside the documentation
BTW, @zaquestion, thanks for your awesome work on this tool!. With K9S, this is one of my favorite tool I use everyday!
I started implementing the behavior in lab
, so hopefully will have time to release that soon and can document that behavior.
Sorry I'm late, but I'd suggest another solution: Allow multiple pairs of host and token in the global config file. If the remote of the repository matches a host entry, use it, otherwise, throw an error.
This can coexist with the local config file change, which isn't a bad thing.
This would require reading the git remote information before initialization; then again, initializing this early (even when only passing commands to git) seems unneccesary anyway.
Agreed, PRs welcome ;)
I'd suggest another solution: Allow multiple pairs of host and token in the global config file.
Please take inspiration from the https://github.com/lighttiger2505/lab project, which provides such feature.
Isn't this issue mostly a duplicate of #151?
It would be nice if you can configure more than one Gitlab repository, for instance, the master gitlab.com and the on-premise Gitlab for something different.