Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch some more hardcoded strings from using staging + generate CLI docs to point to prod #1476

Merged
merged 3 commits into from
Nov 5, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/update-docs-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
shell: bash
run: |
cp config/config.yaml.example config.yaml
make cli-docs
TARGET_ENV=prod make cli-docs

- name: Extract Commit SHA and Details
id: extract_commit_details
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cli-docs:
@mkdir -p docs/docs/ref/cli/commands
@echo 'label: Commands' > docs/docs/ref/cli/commands/_category_.yml
@echo 'position: 20' >> docs/docs/ref/cli/commands/_category_.yml
@go run cmd/cli/main.go docs
@go run -tags '$(BUILDTAGS)' cmd/cli/main.go docs

build: ## build golang binary
# @go build -ldflags "-X main.version=$(shell git describe --abbrev=0 --tags)" -o bin/$(projectname)
Expand Down Expand Up @@ -134,9 +134,9 @@ sqlc: ## generate sqlc files
sqlc generate

migrateup: ## run migrate up
@go run cmd/server/main.go migrate up --yes
@go run -tags '$(BUILDTAGS)' cmd/server/main.go migrate up --yes
migratedown: ## run migrate down
@go run cmd/server/main.go migrate down
@go run -tags '$(BUILDTAGS)' cmd/server/main.go migrate down

dbschema: ## generate database schema with schema spy, monitor file until doc is created and copy it
mkdir -p database/schema/output && chmod a+w database/schema/output
Expand Down
5 changes: 3 additions & 2 deletions cmd/cli/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/stacklok/minder/internal/constants"
"github.com/stacklok/minder/internal/util"
)

Expand Down Expand Up @@ -55,10 +56,10 @@ func Execute() {

func init() {
cobra.OnInitialize(initConfig)
RootCmd.PersistentFlags().String("grpc-host", "staging.stacklok.dev", "Server host")
RootCmd.PersistentFlags().String("grpc-host", constants.MinderGRPCHost, "Server host")
RootCmd.PersistentFlags().Int("grpc-port", 443, "Server port")
RootCmd.PersistentFlags().Bool("grpc-insecure", false, "Allow establishing insecure connections")
RootCmd.PersistentFlags().String("identity-url", "https://auth.staging.stacklok.dev", "Identity server issuer URL")
RootCmd.PersistentFlags().String("identity-url", constants.IdentitySeverURL, "Identity server issuer URL")
RootCmd.PersistentFlags().String("identity-realm", "stacklok", "Identity server realm")
RootCmd.PersistentFlags().String("identity-client", "minder-cli", "Identity server client ID")
RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "Config file (default is $PWD/config.yaml)")
Expand Down
3 changes: 2 additions & 1 deletion internal/auth/jwtauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/spf13/viper"
"golang.org/x/exp/slices"

"github.com/stacklok/minder/internal/constants"
"github.com/stacklok/minder/internal/util"
)

Expand Down Expand Up @@ -173,7 +174,7 @@ type UserDetails struct {
// GetUserDetails is a helper for getting user details such as name and email from the jwt token
func GetUserDetails(ctx context.Context, cmd *cobra.Command, v *viper.Viper) (*UserDetails, error) {
// Extract the config details
issuerUrl := util.GetConfigValue(v, "identity.cli.issuer_url", "identity-url", cmd, "https://auth.staging.stacklok.dev").(string)
issuerUrl := util.GetConfigValue(v, "identity.cli.issuer_url", "identity-url", cmd, constants.IdentitySeverURL).(string)
realm := util.GetConfigValue(v, "identity.cli.realm", "identity-realm", cmd, "stacklok").(string)
clientId := util.GetConfigValue(v, "identity.cli.client_id", "identity-client", cmd, "minder-cli").(string)

Expand Down