Skip to content

Commit

Permalink
Merge branch 'main' into EVEREST-107-automate-veneer-update
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Kralik authored May 31, 2024
2 parents 124c199 + 8206e7e commit ce157f5
Show file tree
Hide file tree
Showing 9 changed files with 425 additions and 151 deletions.
21 changes: 21 additions & 0 deletions api-tests/tests/settings.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// everest
// Copyright (C) 2023 Percona LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { expect, test } from '@fixtures'
import {checkError} from "@tests/tests/helpers";

test('get settings endpoint', async ({ request, cli }) => {
const settings = await request.get('/v1/settings')
await checkError(settings)
})
176 changes: 103 additions & 73 deletions api/everest-server.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions api/settings.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package api

import (
"net/http"

"github.com/AlekSi/pointer"
"github.com/labstack/echo/v4"
"k8s.io/apimachinery/pkg/api/errors"
)

// GetSettings returns the Everest global settings.
func (e *EverestServer) GetSettings(ctx echo.Context) error {
settings, err := e.kubeClient.GetEverestSettings(ctx.Request().Context())
if err != nil && !errors.IsNotFound(err) {
return ctx.JSON(http.StatusInternalServerError, Error{
Message: pointer.To("Failed to get Everest settings"),
})
}
config, err := settings.OIDCConfig()
if err != nil {
return ctx.JSON(http.StatusInternalServerError, Error{
Message: pointer.To("Failed to read Everest settings"),
})
}
return ctx.JSON(http.StatusOK, &Settings{
OidcConfig: OIDCConfig{
ClientId: config.ClientID,
IssuerURL: config.IssuerURL,
},
})
}
Loading

0 comments on commit ce157f5

Please sign in to comment.