@@ -7,11 +7,20 @@ import (
77)
88
99const (
10- AppName = "git-remote-gitopia"
11- gitopiaConfigSection = "gitopia"
10+ AppName = "git-remote-gitopia"
11+ GitopiaConfigSection = "gitopia"
12+ GitopiaConfigChainIdOption = "chainId"
13+ GitopiaConfigGRPCHostOption = "grpcHost"
14+ GitopiaConfigTmAddrOption = "tmAddr"
15+ GitopiaConfigGitServerHostOption = "gitServerHost"
16+ GitopiaConfigKeyOption = "key"
17+ GitopiaConfigBackendOption = "backend"
18+ GitopiaConfigGasPricesOption = "gasPrices"
19+ GitopiaConfigFeeGranterOption = "feeGranter"
20+ GitopiaConfigDenomOption = "denom"
1221)
1322
14- func gitConfigGet (key string ) (string , error ) {
23+ func GitConfigGet (key string ) (string , error ) {
1524 cmd := exec .Command ("git" , "config" , "--get" , fmt .Sprintf ("gitopia.%s" , key ))
1625 stdout , err := cmd .Output ()
1726
@@ -24,25 +33,19 @@ func gitConfigGet(key string) (string, error) {
2433}
2534
2635func LoadGitConfig () error {
27- if res , err := gitConfigGet ( "chainId" ); err == nil {
36+ if res , err := GitConfigGet ( GitopiaConfigChainIdOption ); err == nil {
2837 ChainId = res
2938 }
30- if res , err := gitConfigGet ("grpcHost" ); err == nil {
31- GRPCHost = res
32- }
33- if res , err := gitConfigGet ("gitServerHost" ); err == nil {
39+ if res , err := GitConfigGet (GitopiaConfigGitServerHostOption ); err == nil {
3440 GitServerHost = res
3541 }
36- if res , err := gitConfigGet ("tmAddr" ); err == nil {
37- TmAddr = res
38- }
39- if res , err := gitConfigGet ("gasPrices" ); err == nil {
42+ if res , err := GitConfigGet (GitopiaConfigGasPricesOption ); err == nil {
4043 GasPrices = res
4144 }
42- if res , err := gitConfigGet ( "feeGranter" ); err == nil {
45+ if res , err := GitConfigGet ( GitopiaConfigFeeGranterOption ); err == nil {
4346 FeeGranterAddr = res
4447 }
45- if res , err := gitConfigGet ( "denom" ); err == nil {
48+ if res , err := GitConfigGet ( GitopiaConfigDenomOption ); err == nil {
4649 Denom = res
4750 }
4851 return nil
0 commit comments