mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 13:40:11 +05:30
Конфиг Accounts API вынесен в параметры окружения
This commit is contained in:
parent
8693673a71
commit
cbe940f8ec
@ -12,6 +12,10 @@ services:
|
||||
- redis
|
||||
- rabbitmq
|
||||
- statsd
|
||||
environment:
|
||||
ACCOUNTS_API_ID: ""
|
||||
ACCOUNTS_API_SECRET: ""
|
||||
STATSD_ADDR: ""
|
||||
|
||||
redis:
|
||||
extends:
|
||||
|
@ -8,6 +8,10 @@ services:
|
||||
- redis
|
||||
- rabbitmq
|
||||
restart: always
|
||||
environment:
|
||||
ACCOUNTS_API_ID: ""
|
||||
ACCOUNTS_API_SECRET: ""
|
||||
STATSD_ADDR: ""
|
||||
|
||||
redis:
|
||||
extends:
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"elyby/minecraft-skinsystem/lib/external/accounts"
|
||||
)
|
||||
|
||||
var AccountsTokenConfig *accounts.TokenRequest
|
||||
|
||||
var token *accounts.Token
|
||||
|
||||
const repeatsLimit = 3
|
||||
@ -40,13 +42,7 @@ func _getByField(field string, value string) (accounts.AccountInfoResponse, erro
|
||||
|
||||
func getToken() (*accounts.Token, error) {
|
||||
if token == nil {
|
||||
tempToken, err := accounts.GetToken(accounts.TokenRequest{
|
||||
Id: "skinsystem",
|
||||
Secret: "qugFIaCjec3LMA",
|
||||
Scopes: []string{
|
||||
"internal_account_info",
|
||||
},
|
||||
})
|
||||
tempToken, err := accounts.GetToken(*AccountsTokenConfig)
|
||||
if err != nil {
|
||||
return &accounts.Token{}, err
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"elyby/minecraft-skinsystem/lib/routes"
|
||||
"elyby/minecraft-skinsystem/lib/services"
|
||||
"elyby/minecraft-skinsystem/lib/worker"
|
||||
"elyby/minecraft-skinsystem/lib/external/accounts"
|
||||
)
|
||||
|
||||
const redisPoolSize int = 10
|
||||
@ -28,6 +29,20 @@ func main() {
|
||||
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
||||
accountsApiId := os.Getenv("ACCOUNTS_API_ID")
|
||||
accountsApiSecret := os.Getenv("ACCOUNTS_API_SECRET")
|
||||
if accountsApiId == "" || accountsApiSecret == "" {
|
||||
log.Fatal("ACCOUNTS_API params must be provided")
|
||||
}
|
||||
|
||||
worker.AccountsTokenConfig = &accounts.TokenRequest{
|
||||
Id: accountsApiId,
|
||||
Secret: accountsApiSecret,
|
||||
Scopes: []string{
|
||||
"internal_account_info",
|
||||
},
|
||||
}
|
||||
|
||||
log.Println("Connecting to redis")
|
||||
|
||||
var redisString = os.Getenv("REDIS_ADDR")
|
||||
@ -62,6 +77,7 @@ func main() {
|
||||
|
||||
// statsd
|
||||
var statsdString = os.Getenv("STATSD_ADDR")
|
||||
statsdString = ""
|
||||
if (statsdString != "") {
|
||||
log.Println("Connecting to statsd")
|
||||
hostname, _ := os.Hostname()
|
||||
|
Loading…
Reference in New Issue
Block a user