Skip to content

Commit

Permalink
fix bug when api version would be set to 0 if there is no `m1k1o.neko…
Browse files Browse the repository at this point in the history
…_rooms.api_version` label and `org.opencontainers.image.` contains different URL.
  • Loading branch information
m1k1o committed Sep 13, 2024
1 parent e61f6bf commit 3aeaf6a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/room/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,17 @@ func (manager *RoomManagerCtx) Create(ctx context.Context, settings types.RoomSe

// based on opencontainers image url label
if val, ok := inspect.Config.Labels["org.opencontainers.image.url"]; ok {
// TODO: this should be removed in future, but since we have a lot of legacy images, we need to support it
switch val {
case "https://github.com/m1k1o/neko":
settings.ApiVersion = 2
case "https://github.com/demodesk/neko":
settings.ApiVersion = 3
}
} else
}

// unable to detect api version
{
// still unable to detect api version
if settings.ApiVersion == 0 {
// TODO: this should be removed in future, but since we have a lot of v2 images, we need to support it
log.Warn().Str("image", settings.NekoImage).Msg("unable to detect api version, fallback to v2")
settings.ApiVersion = 2
Expand Down

0 comments on commit 3aeaf6a

Please sign in to comment.