Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/MakeNowJust/heredoc"
"github.com/raystack/salt/cmdx"
"github.com/raystack/salt/config"
"github.com/spf13/cobra"
)

Expand All @@ -13,12 +13,12 @@ type Config struct {
}

func LoadConfig() (*Config, error) {
var config Config
var cfg Config

cfg := cmdx.SetConfig("frontier")
err := cfg.Load(&config)
loader := config.NewLoader(config.WithAppConfig("frontier"))
err := loader.Load(&cfg)

return &config, err
return &cfg, err
}

func configCommand() *cobra.Command {
Expand Down Expand Up @@ -47,13 +47,13 @@ func configInitCommand() *cobra.Command {
"group": "core",
},
RunE: func(cmd *cobra.Command, args []string) error {
cfg := cmdx.SetConfig("frontier")
loader := config.NewLoader(config.WithAppConfig("frontier"))

if err := cfg.Init(&Config{}); err != nil {
if err := loader.Init(&Config{}); err != nil {
return err
}

fmt.Printf("config created: %v\n", cfg.File())
fmt.Println("config created")
return nil
},
}
Expand All @@ -70,9 +70,9 @@ func configListCommand() *cobra.Command {
"group": "core",
},
RunE: func(cmd *cobra.Command, args []string) error {
cfg := cmdx.SetConfig("frontier")
loader := config.NewLoader(config.WithAppConfig("frontier"))

data, err := cfg.Read()
data, err := loader.View()
if err != nil {
return ErrClientConfigNotFound
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/frontier/pkg/file"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/MakeNowJust/heredoc"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/frontier/pkg/file"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/frontier/pkg/file"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/frontier/pkg/file"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/preferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/MakeNowJust/heredoc"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
"github.com/spf13/cobra"
cli "github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/frontier/pkg/file"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/frontier/pkg/file"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
cli "github.com/spf13/cobra"
)

Expand Down
14 changes: 8 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/salt/cmdx"
"github.com/raystack/salt/cli/commander"
"github.com/spf13/cobra"
cli "github.com/spf13/cobra"
)
Expand Down Expand Up @@ -54,10 +54,12 @@ func New(cliConfig *Config) *cli.Command {
cmd.AddCommand(PreferencesCommand(cliConfig))

// Help topics
cmdx.SetHelp(cmd)
cmd.AddCommand(cmdx.SetCompletionCmd("frontier"))
cmd.AddCommand(cmdx.SetHelpTopicCmd("environment", envHelp))
cmd.AddCommand(cmdx.SetHelpTopicCmd("auth", authHelp))
cmd.AddCommand(cmdx.SetRefCmd(cmd))
manager := commander.New(cmd,
commander.WithTopics([]commander.HelpTopic{
{Name: "environment", Short: envHelp["short"], Long: envHelp["long"]},
{Name: "auth", Short: authHelp["short"], Long: authHelp["long"]},
}),
)
manager.Init()
return cmd
}
2 changes: 1 addition & 1 deletion cmd/seed.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/frontier/config"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/raystack/frontier/pkg/file"
"github.com/raystack/frontier/pkg/str"
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
cli "github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/raystack/frontier/config"

"github.com/raystack/salt/version"
"github.com/raystack/salt/cli/releaser"
"github.com/spf13/cobra"
)

Expand All @@ -22,7 +22,7 @@ func versionCommand() *cobra.Command {
}
fmt.Println("Frontier: A secure and easy-to-use Authentication & Authorization Server")
fmt.Printf("Version: %s\nBuild date: %s\nCommit: %s", config.Version, config.BuildDate, config.BuildCommit)
fmt.Println(version.UpdateNotice(config.Version, "raystack/frontier"))
fmt.Println(releaser.CheckForUpdate(config.Version, "raystack/frontier"))
return nil
},
}
Expand Down
21 changes: 2 additions & 19 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package config

import (
"errors"
"fmt"
"os"
"path/filepath"

"github.com/raystack/frontier/billing"

Expand Down Expand Up @@ -37,20 +34,8 @@ type NewRelic struct {
func Load(serverConfigFileFromFlag string) (*Frontier, error) {
conf := &Frontier{}

var options []config.LoaderOption
options = append(options, config.WithName("config"))
options = append(options, config.WithEnvKeyReplacer(".", "_"))
var options []config.Option
options = append(options, config.WithEnvPrefix("FRONTIER"))
if p, err := os.Getwd(); err == nil {
options = append(options, config.WithPath(p))
}
if execPath, err := os.Executable(); err == nil {
options = append(options, config.WithPath(filepath.Dir(execPath)))
}
if currentHomeDir, err := os.UserHomeDir(); err == nil {
options = append(options, config.WithPath(currentHomeDir))
options = append(options, config.WithPath(filepath.Join(currentHomeDir, ".config")))
}

// override all config sources and prioritize one from file
if serverConfigFileFromFlag != "" {
Expand All @@ -59,9 +44,7 @@ func Load(serverConfigFileFromFlag string) (*Frontier, error) {

l := config.NewLoader(options...)
if err := l.Load(conf); err != nil {
if !errors.As(err, &config.ConfigFileNotFoundError{}) {
return nil, err
}
return nil, err
}

// backward compatibility
Expand Down
40 changes: 22 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ go 1.23.0

require (
connectrpc.com/connect v1.18.1
connectrpc.com/cors v0.1.0
connectrpc.com/grpchealth v1.4.0
connectrpc.com/grpcreflect v1.3.0
connectrpc.com/otelconnect v0.7.2
github.com/MakeNowJust/heredoc v1.0.0
github.com/authzed/authzed-go v0.11.2-0.20240507202708-8b150c491e4a
Expand All @@ -13,18 +15,18 @@ require (
github.com/cespare/xxhash v1.1.0
github.com/coreos/go-oidc/v3 v3.5.0
github.com/doug-martin/goqu/v9 v9.18.0
github.com/envoyproxy/protoc-gen-validate v1.0.4
github.com/envoyproxy/protoc-gen-validate v1.1.0
github.com/ghodss/yaml v1.0.0
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48
github.com/go-webauthn/webauthn v0.8.6
github.com/golang-migrate/migrate/v4 v4.15.2
github.com/golang-migrate/migrate/v4 v4.16.0
github.com/golang/protobuf v1.5.4
github.com/google/go-cmp v0.7.0
github.com/google/uuid v1.6.0
github.com/gorilla/securecookie v1.1.1
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0
github.com/jackc/pgconn v1.14.3
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa
github.com/jackc/pgx/v4 v4.18.2
Expand All @@ -39,21 +41,22 @@ require (
github.com/ory/dockertest/v3 v3.10.0
github.com/pkg/errors v0.9.1
github.com/pkg/profile v1.7.0
github.com/raystack/salt v0.3.8
github.com/raystack/salt v0.6.2
github.com/robfig/cron/v3 v3.0.1
github.com/spf13/cobra v1.8.0
github.com/rs/cors v1.11.1
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.10.0
github.com/stripe/stripe-go/v79 v79.5.0
github.com/ua-parser/uap-go v0.0.0-20250917011043-9c86a9b0f8f0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.51.0
go.opentelemetry.io/otel v1.37.0
go.opentelemetry.io/otel/sdk/metric v1.37.0
go.uber.org/zap v1.26.0
gocloud.dev v0.28.0
golang.org/x/net v0.42.0
golang.org/x/oauth2 v0.30.0
golang.org/x/sync v0.16.0
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be
google.golang.org/grpc v1.63.2
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9
google.golang.org/grpc v1.67.1
google.golang.org/protobuf v1.36.6
gopkg.in/dnaeon/go-vcr.v3 v3.1.2
gopkg.in/mail.v2 v2.3.1
Expand All @@ -64,8 +67,6 @@ require (
require (
cloud.google.com/go/auth v0.3.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
connectrpc.com/cors v0.1.0 // indirect
connectrpc.com/grpcreflect v1.3.0 // indirect
dario.cat/mergo v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
Expand Down Expand Up @@ -94,44 +95,47 @@ require (
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator v9.31.0+incompatible // indirect
github.com/go-webauthn/x v0.1.4 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/google/go-tpm v0.9.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/planetscale/vtprotobuf v0.6.0 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/samber/lo v1.39.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/ua-parser/uap-go v0.0.0-20250917011043-9c86a9b0f8f0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
golang.org/x/mod v0.25.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.34.0 // indirect
google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
)

require (
cloud.google.com/go v0.112.2 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/compute/metadata v0.5.0 // indirect
cloud.google.com/go/iam v1.1.7 // indirect
cloud.google.com/go/storage v1.39.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
Expand All @@ -150,7 +154,7 @@ require (
github.com/charmbracelet/glamour v0.6.0 // indirect
github.com/cli/safeexec v1.0.1 // indirect
github.com/containerd/continuity v0.4.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/dalzilio/rudd v1.1.1-0.20230806153452-9e08a6ea8170 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
Expand Down Expand Up @@ -222,7 +226,7 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/cast v1.6.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.18.2 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
Expand Down
Loading
Loading