feinoujc/gh-search-cli

Configure multiple base urls/tokens

friederbluemle opened this issue ยท 2 comments

Thanks for this awesome project! ๐Ÿ‘

My question is: Is it possible to configure the tool in a way that it can work with both public GitHub and a GitHub Enterprise instance at the same time?

Currently, the config looks like this:

{
  "baseUrl": "https://api.github.com",
  "token": "03cfd743661f07975fa2f1220c5194cbaff48451"
}

Maybe something like this would enable that?

{
  "instances": [
    {
      "baseUrl": "https://api.github.com",
      "token": "03cfd743661f07975fa2f1220c5194cbaff48451"
    },
    {
      "baseUrl": "https://github.company.com",
      "token": "7b18d017f89f61cf17d47f92749ea6930a3f1deb"
    }
  ]
}

or, backwards compatible:

{
  "baseUrl": "https://api.github.com",
  "token": "03cfd743661f07975fa2f1220c5194cbaff48451",
  "ghe": {
    "baseUrl": "https://github.company.com",
    "token": "7b18d017f89f61cf17d47f92749ea6930a3f1deb"
  }
}

Then, for example,

ghs code testing -> Would search public GitHub

ghs -e code testing -> Would search GitHub Enterprise

I only started using this project, so maybe the functionality is already available in a different way?

Hey @friederbluemle I definitely like the idea! Maybe the first example with a migration check if the config format was in the old format? Did you want to take a stab at implementing this?

Hi, I have an important issue. Currently, the config looks like this:

I need to search as follow, but nothing is show.

ghs code --filename Dockerfile --in centos
Warning: no results found