Skip to content

Commit

Permalink
[IGNORE] move again the config into the pkg model (#1639)
Browse files Browse the repository at this point in the history
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
  • Loading branch information
Nexucis authored Dec 11, 2023
1 parent 646c23b commit a238e2f
Show file tree
Hide file tree
Showing 28 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion cmd/perses/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"flag"

"github.com/perses/perses/internal/api/core"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
"github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/api/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/perses/perses/internal/api/shared/migrate"
"github.com/perses/perses/internal/api/shared/rbac"
"github.com/perses/perses/internal/api/shared/schemas"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
"github.com/perses/perses/ui"
"github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/core/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"github.com/perses/perses/internal/api/shared"
"github.com/perses/perses/internal/api/shared/dependency"
"github.com/perses/perses/internal/api/shared/utils"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
)

type endpoint interface {
Expand Down
6 changes: 3 additions & 3 deletions internal/api/e2e/api/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ import (
databaseModel "github.com/perses/perses/internal/api/shared/database/model"
"github.com/perses/perses/internal/api/shared/dependency"
"github.com/perses/perses/internal/api/shared/utils"
"github.com/perses/perses/pkg/api/config"
modelAPI "github.com/perses/perses/pkg/model/api"
apiConfig "github.com/perses/perses/pkg/model/api/config"
"github.com/perses/perses/pkg/model/api/v1/role"
"github.com/stretchr/testify/assert"
)

func serverAuthConfig() config.Config {
func serverAuthConfig() apiConfig.Config {
conf := e2eframework.DefaultConfig()
conf.Security.EnableAuth = true
conf.Security.Authorization = config.AuthorizationConfig{GuestPermissions: []*role.Permission{
conf.Security.Authorization = apiConfig.AuthorizationConfig{GuestPermissions: []*role.Permission{
{
Actions: []role.Action{role.ReadAction},
Scopes: []role.Scope{role.WildcardScope},
Expand Down
42 changes: 21 additions & 21 deletions internal/api/e2e/framework/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,33 @@ import (
databaseModel "github.com/perses/perses/internal/api/shared/database/model"
"github.com/perses/perses/internal/api/shared/dependency"
"github.com/perses/perses/internal/test"
"github.com/perses/perses/pkg/api/config"
modelAPI "github.com/perses/perses/pkg/model/api"
apiConfig "github.com/perses/perses/pkg/model/api/config"
modelV1 "github.com/perses/perses/pkg/model/api/v1"
"github.com/prometheus/client_golang/prometheus"
promConfig "github.com/prometheus/common/config"
)

var useSQL = os.Getenv("PERSES_TEST_USE_SQL")

func DefaultConfig() config.Config {
func DefaultConfig() apiConfig.Config {
projectPath := test.GetRepositoryPath()
return config.Config{
Security: config.Security{
return apiConfig.Config{
Security: apiConfig.Security{
Readonly: false,
EnableAuth: false,
Authorization: config.AuthorizationConfig{},
Authentication: config.AuthenticationConfig{
AccessTokenTTL: config.DefaultAccessTokenTTL,
RefreshTokenTTL: config.DefaultRefreshTokenTTL,
Authorization: apiConfig.AuthorizationConfig{},
Authentication: apiConfig.AuthenticationConfig{
AccessTokenTTL: apiConfig.DefaultAccessTokenTTL,
RefreshTokenTTL: apiConfig.DefaultRefreshTokenTTL,
},
EncryptionKey: promConfig.Secret(hex.EncodeToString([]byte("=tW$56zytgB&3jN2E%7-+qrGZE?v6LCc"))),
},
Schemas: config.Schemas{
PanelsPath: filepath.Join(projectPath, config.DefaultPanelsPath),
QueriesPath: filepath.Join(projectPath, config.DefaultQueriesPath),
DatasourcesPath: filepath.Join(projectPath, config.DefaultDatasourcesPath),
VariablesPath: filepath.Join(projectPath, config.DefaultVariablesPath),
Schemas: apiConfig.Schemas{
PanelsPath: filepath.Join(projectPath, apiConfig.DefaultPanelsPath),
QueriesPath: filepath.Join(projectPath, apiConfig.DefaultQueriesPath),
DatasourcesPath: filepath.Join(projectPath, apiConfig.DefaultDatasourcesPath),
VariablesPath: filepath.Join(projectPath, apiConfig.DefaultVariablesPath),
Interval: 0,
},
}
Expand All @@ -68,17 +68,17 @@ func ClearAllKeys(t *testing.T, dao databaseModel.DAO, entities ...modelAPI.Enti
}
}

func defaultFileConfig() *config.File {
return &config.File{
func defaultFileConfig() *apiConfig.File {
return &apiConfig.File{
Folder: "./test",
Extension: config.JSONExtension,
Extension: apiConfig.JSONExtension,
}
}

func CreateServer(t *testing.T, conf config.Config) (*httptest.Server, *httpexpect.Expect, dependency.PersistenceManager) {
func CreateServer(t *testing.T, conf apiConfig.Config) (*httptest.Server, *httpexpect.Expect, dependency.PersistenceManager) {
if useSQL == "true" {
conf.Database = config.Database{
SQL: &config.SQL{
conf.Database = apiConfig.Database{
SQL: &apiConfig.SQL{
User: "user",
Password: "password",
Net: "tcp",
Expand All @@ -88,7 +88,7 @@ func CreateServer(t *testing.T, conf config.Config) (*httptest.Server, *httpexpe
},
}
} else {
conf.Database = config.Database{
conf.Database = apiConfig.Database{
File: defaultFileConfig(),
}
}
Expand Down Expand Up @@ -116,7 +116,7 @@ func WithServer(t *testing.T, testFunc func(*httpexpect.Expect, dependency.Persi
ClearAllKeys(t, persistenceManager.GetPersesDAO(), entities...)
}

func WithServerConfig(t *testing.T, config config.Config, testFunc func(*httpexpect.Expect, dependency.PersistenceManager) []modelAPI.Entity) {
func WithServerConfig(t *testing.T, config apiConfig.Config, testFunc func(*httpexpect.Expect, dependency.PersistenceManager) []modelAPI.Entity) {
server, expect, persistenceManager := CreateServer(t, config)
defer persistenceManager.GetPersesDAO().Close()
defer server.Close()
Expand Down
2 changes: 1 addition & 1 deletion internal/api/impl/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/labstack/echo/v4"
"github.com/perses/perses/internal/api/shared"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
)

type Endpoint struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"
"io"

"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
modelV1 "github.com/perses/perses/pkg/model/api/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
databaseFile "github.com/perses/perses/internal/api/shared/database/file"
databaseModel "github.com/perses/perses/internal/api/shared/database/model"
databaseSQL "github.com/perses/perses/internal/api/shared/database/sql"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
promConfig "github.com/prometheus/common/config"
"github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/database/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"strings"

databaseModel "github.com/perses/perses/internal/api/shared/database/model"
"github.com/perses/perses/pkg/api/config"
modelAPI "github.com/perses/perses/pkg/model/api"
"github.com/perses/perses/pkg/model/api/config"
modelV1 "github.com/perses/perses/pkg/model/api/v1"
"gopkg.in/yaml.v3"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/database/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/perses/perses/internal/api/interface/v1/project"
databaseModel "github.com/perses/perses/internal/api/shared/database/model"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
modelV1 "github.com/perses/perses/pkg/model/api/v1"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/dependency/persistence_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
"github.com/perses/perses/internal/api/interface/v1/variable"
"github.com/perses/perses/internal/api/shared/database"
databaseModel "github.com/perses/perses/internal/api/shared/database/model"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
)

type PersistenceManager interface {
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/dependency/service_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (
"github.com/perses/perses/internal/api/shared/migrate"
"github.com/perses/perses/internal/api/shared/rbac"
"github.com/perses/perses/internal/api/shared/schemas"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
)

type ServiceManager interface {
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"cuelang.org/go/cue/cuecontext"
"github.com/perses/perses/internal/api/shared"
"github.com/perses/perses/internal/api/shared/schemas"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
v1 "github.com/perses/perses/pkg/model/api/v1"
"github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/migrate/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"

testUtils "github.com/perses/perses/internal/test"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/rbac/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/perses/perses/internal/api/interface/v1/role"
"github.com/perses/perses/internal/api/interface/v1/rolebinding"
"github.com/perses/perses/internal/api/interface/v1/user"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
v1Role "github.com/perses/perses/pkg/model/api/v1/role"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/schemas/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"cuelang.org/go/cue"
"cuelang.org/go/cue/cuecontext"
"cuelang.org/go/cue/errors"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
modelV1 "github.com/perses/perses/pkg/model/api/v1"
"github.com/perses/perses/pkg/model/api/v1/common"
"github.com/perses/perses/pkg/model/api/v1/dashboard"
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/schemas/schemas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"
"time"

"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
v1 "github.com/perses/perses/pkg/model/api/v1"
"github.com/perses/perses/pkg/model/api/v1/common"
"github.com/perses/perses/pkg/model/api/v1/dashboard"
Expand Down
2 changes: 1 addition & 1 deletion internal/api/shared/validate/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/perses/perses/internal/api/shared/schemas"
testUtils "github.com/perses/perses/internal/test"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
modelV1 "github.com/perses/perses/pkg/model/api/v1"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/cmd/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"github.com/perses/perses/internal/cli/file"
"github.com/perses/perses/internal/cli/opt"
"github.com/perses/perses/internal/cli/output"
apiConfig "github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/client/api"
modelAPI "github.com/perses/perses/pkg/model/api"
apiConfig "github.com/perses/perses/pkg/model/api/config"
modelV1 "github.com/perses/perses/pkg/model/api/v1"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/cmd/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"github.com/perses/perses/internal/cli/file"
"github.com/perses/perses/internal/cli/opt"
"github.com/perses/perses/internal/cli/output"
apiConfig "github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/client/api"
modelAPI "github.com/perses/perses/pkg/model/api"
apiConfig "github.com/perses/perses/pkg/model/api/config"
modelV1 "github.com/perses/perses/pkg/model/api/v1"
"github.com/spf13/cobra"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/cue-test/cue-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/perses/perses/internal/api/shared/schemas"
"github.com/perses/perses/internal/api/shared/validate"
"github.com/perses/perses/pkg/api/config"
"github.com/perses/perses/pkg/model/api/config"
v1 "github.com/perses/perses/pkg/model/api/v1"
"github.com/perses/perses/pkg/model/api/v1/common"
"github.com/sirupsen/logrus"
Expand Down

0 comments on commit a238e2f

Please sign in to comment.