-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'flyover-2.1.1' into refund-scripts
- Loading branch information
Showing
22 changed files
with
250 additions
and
25 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
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
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
26 changes: 26 additions & 0 deletions
26
internal/adapters/entrypoints/rest/handlers/get_version_info.go
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,26 @@ | ||
package handlers | ||
|
||
import ( | ||
"github.com/rsksmart/liquidity-provider-server/internal/adapters/entrypoints/rest" | ||
"github.com/rsksmart/liquidity-provider-server/internal/usecases/liquidity_provider" | ||
"github.com/rsksmart/liquidity-provider-server/pkg" | ||
"net/http" | ||
) | ||
|
||
// NewVersionInfoHandler | ||
// @Title Get server version | ||
// @Description Returns the server version and revision | ||
// @Route /version [get] | ||
// @Success 200 object pkg.ServerInfoDTO | ||
func NewVersionInfoHandler(useCase *liquidity_provider.ServerInfoUseCase) http.HandlerFunc { | ||
return func(w http.ResponseWriter, req *http.Request) { | ||
version, err := useCase.Run() | ||
if err != nil { | ||
rest.JsonErrorResponse(w, http.StatusInternalServerError, rest.NewErrorResponse(err.Error(), false)) | ||
return | ||
} | ||
|
||
dto := pkg.ToServerInfoDTO(version) | ||
rest.JsonResponseWithBody(w, http.StatusOK, &dto) | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package liquidity_provider | ||
|
||
import ( | ||
"errors" | ||
"github.com/rsksmart/liquidity-provider-server/internal/entities/liquidity_provider" | ||
"github.com/rsksmart/liquidity-provider-server/internal/usecases" | ||
) | ||
|
||
var ( | ||
BuildVersion string | ||
BuildRevision string | ||
) | ||
|
||
type ServerInfoUseCase struct{} | ||
|
||
func NewServerInfoUseCase() *ServerInfoUseCase { | ||
return &ServerInfoUseCase{} | ||
} | ||
|
||
func (useCase *ServerInfoUseCase) Run() (liquidity_provider.ServerInfo, error) { | ||
if BuildVersion == "" || BuildRevision == "" { | ||
return liquidity_provider.ServerInfo{}, usecases.WrapUseCaseError(usecases.ServerInfoId, errors.New("unable to read build info")) | ||
} | ||
return liquidity_provider.ServerInfo{ | ||
Version: BuildVersion, | ||
Revision: BuildRevision, | ||
}, nil | ||
} |
Oops, something went wrong.