From 623a9f2fa3399dedb88eea72a91baf235a66498e Mon Sep 17 00:00:00 2001
From: Artem <aopoltorzhicky@gmail.com>
Date: Fri, 20 May 2022 17:35:12 +0300
Subject: [PATCH] Fix: config API

---
 cmd/api/handlers/config.go | 3 ++-
 cmd/api/main.go            | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/cmd/api/handlers/config.go b/cmd/api/handlers/config.go
index 11840cf1c..2dc21bdc2 100644
--- a/cmd/api/handlers/config.go
+++ b/cmd/api/handlers/config.go
@@ -10,7 +10,8 @@ import (
 // GetConfig -
 func GetConfig() gin.HandlerFunc {
 	return func(c *gin.Context) {
-		ctx := c.MustGet("context").(*config.Context)
+		ctxs := c.MustGet("contexts").(config.Contexts)
+		ctx := ctxs.Any()
 
 		tzktEndpoints := make(map[string]string)
 		for network, tzkt := range ctx.Config.TzKT {
diff --git a/cmd/api/main.go b/cmd/api/main.go
index 7924a84f7..fab04dbf9 100644
--- a/cmd/api/main.go
+++ b/cmd/api/main.go
@@ -87,7 +87,7 @@ func (api *app) makeRouter() {
 	v1 := r.Group("v1")
 	{
 		v1.GET("swagger.json", handlers.MainnetMiddleware(api.Contexts), handlers.GetSwaggerDoc())
-		v1.GET("config", handlers.MainnetMiddleware(api.Contexts), handlers.GetConfig())
+		v1.GET("config", handlers.ContextsMiddleware(api.Contexts), handlers.GetConfig())
 
 		v1.GET("head", handlers.ContextsMiddleware(api.Contexts), cache.CachePage(store, time.Second*10, handlers.GetHead()))
 		v1.GET("head/:network", handlers.NetworkMiddleware(api.Contexts), cache.CachePage(store, time.Second*10, handlers.GetHeadByNetwork()))