diff options
author | Michael Muré <batolettre@gmail.com> | 2019-11-24 23:54:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-24 23:54:23 +0100 |
commit | 44f648a931b43d707d37cb469fead5e21a615e04 (patch) | |
tree | 356bbe10b81a1ed06ded54a5570027fda51fead6 /bridge/core/bridge.go | |
parent | 6345895a3d9a055927f1d4b78f254a55c1d271b6 (diff) | |
parent | 06abb5a5312dfaa1edac58cced94691e477c2ed7 (diff) | |
download | git-bug-44f648a931b43d707d37cb469fead5e21a615e04.tar.gz |
Merge pull request #260 from MichaelMure/bridge
Support bridge configuration with global tokens
Diffstat (limited to 'bridge/core/bridge.go')
-rw-r--r-- | bridge/core/bridge.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go index a3133b9c..3a36dfaa 100644 --- a/bridge/core/bridge.go +++ b/bridge/core/bridge.go @@ -13,6 +13,7 @@ import ( "github.com/pkg/errors" "github.com/MichaelMure/git-bug/cache" + "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/repository" ) @@ -20,8 +21,10 @@ var ErrImportNotSupported = errors.New("import is not supported") var ErrExportNotSupported = errors.New("export is not supported") const ( - ConfigKeyTarget = "target" - MetaKeyOrigin = "origin" + ConfigKeyTarget = "target" + ConfigKeyToken = "token" + ConfigKeyTokenId = "token-id" + MetaKeyOrigin = "origin" bridgeConfigKeyPrefix = "git-bug.bridge" ) @@ -35,6 +38,7 @@ type BridgeParams struct { Project string URL string Token string + TokenId string TokenStdin bool } @@ -276,6 +280,13 @@ func (b *Bridge) ensureInit() error { return nil } + token, err := LoadToken(b.repo, entity.Id(b.conf[ConfigKeyTokenId])) + if err != nil { + return err + } + + b.conf[ConfigKeyToken] = token.Value + importer := b.getImporter() if importer != nil { err := importer.Init(b.conf) |