Skip to content

Commit

Permalink
Change env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirRezaM75 committed Oct 27, 2024
1 parent fee6a36 commit 9813652
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MONGODB_AUTH_SOURCE=admin
KENOPSIA_USER_BASE_URL=http://kenopsia-user-app:3000
KENOPSIA_LOBBY_BASE_URL=http://kenopsia-lobby-app:3001
KENOPSIA_TOKEN=
SKULL_KING_AI_BASE_UR=
SKULL_KING_AI_BASE_URL=

BROKER_REDIS_HOST=kenopsia-broker-redis
BROKER_REDIS_PORT=6379
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func main() {

gameRepository := repositories.NewGameRepository(db)

botRepository := repositories.NewBotRepository(os.Getenv("SKULL_KING_AI_BASE_UR"))
botRepository := repositories.NewBotRepository(os.Getenv("SKULL_KING_AI_BASE_URL"))

var broker = initBroker()

Expand Down
28 changes: 8 additions & 20 deletions models/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,21 +712,21 @@ func (game *Game) findPlayerIndexById(playerId string) int {
}
}

func (game *Game) findPlayerByIndex(index int) *Player {
var player *Player
func (game *Game) findPlayerIdByIndex(index int) string {
var id = ""

game.Players.Range(func(_ string, p *Player) bool {
if p.Index == index {
player = p
game.Players.Range(func(_ string, player *Player) bool {
if player.Index == index {
id = player.Id
return false
}
return true
})

if player == nil {
if id == "" {
log.Println(
fmt.Sprintf(
"ERROR: Unable to find player by index %d. [gameId: %s, round: %d, trick: %d]",
"ERROR: Unable to find player index %d within for loop. [gameId: %s, round: %d, trick: %d]",
index,
game.Id,
game.Round,
Expand All @@ -735,18 +735,6 @@ func (game *Game) findPlayerByIndex(index int) *Player {
)
}

return player
}

func (game *Game) findPlayerIdByIndex(index int) string {
var player = game.findPlayerByIndex(index)

var id = ""

if player != nil {
id = player.Id
}

return id
}

Expand Down Expand Up @@ -815,7 +803,7 @@ func (game *Game) handleBotsBid(hub *Hub) {
return true
}

game.getCurrentRound().Bids.Store(player.Id, bid)
game.Bid(hub, player.Id, bid)

return true
})
Expand Down

0 comments on commit 9813652

Please sign in to comment.