-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhaomingqiang
committed
Oct 31, 2020
1 parent
64e7a66
commit 4bb7a11
Showing
9 changed files
with
57 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ output | |
coverage | ||
modules.txt | ||
*.log | ||
test | ||
*_test.go | ||
*.json | ||
*.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package test | ||
|
||
import ( | ||
"github.com/larksuite/oapi-sdk-go/core/config" | ||
"github.com/larksuite/oapi-sdk-go/core/constants" | ||
"os" | ||
"strings" | ||
) | ||
|
||
func domainFeiShu(env string) string { | ||
return os.Getenv(env + "_FEISHU_DOMAIN") | ||
} | ||
|
||
func getISVAppSettings(env string) *config.AppSettings { | ||
appID, appSecret, verificationToken, encryptKey := os.Getenv(env+"_ISV_APP_ID"), | ||
os.Getenv(env+"_ISV_APP_SECRET"), os.Getenv(env+"_ISV_VERIFICATION_TOKEN"), os.Getenv(env+"_ISV_ENCRYPT_KEY") | ||
return config.NewISVAppSettings(appID, appSecret, verificationToken, encryptKey) | ||
} | ||
|
||
func getInternalAppSettings(env string) *config.AppSettings { | ||
appID, appSecret, verificationToken, encryptKey := os.Getenv(env+"_INTERNAL_APP_ID"), | ||
os.Getenv(env+"_INTERNAL_APP_SECRET"), os.Getenv(env+"_INTERNAL_VERIFICATION_TOKEN"), os.Getenv(env+"_INTERNAL_ENCRYPT_KEY") | ||
return config.NewInternalAppSettings(appID, appSecret, verificationToken, encryptKey) | ||
} | ||
|
||
func GetISVConf(env string) *config.Config { | ||
env = strings.ToUpper(env) | ||
return config.NewTestConfig(getDomain(env), getISVAppSettings(env)) | ||
} | ||
|
||
func GetInternalConf(env string) *config.Config { | ||
env = strings.ToUpper(env) | ||
return config.NewTestConfig(getDomain(env), getInternalAppSettings(env)) | ||
} | ||
|
||
func getDomain(env string) constants.Domain { | ||
if env != "STAGING" && env != "PRE" && env != "ONLINE" { | ||
panic("env must in [staging, pre, online]") | ||
} | ||
if env == "ONLINE" { | ||
return constants.DomainFeiShu | ||
} | ||
return constants.Domain(domainFeiShu(env)) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters