Skip to content

Commit 027a1a9

Browse files
committed
fix: lint build fix
1 parent 1fa9990 commit 027a1a9

1 file changed

Lines changed: 43 additions & 43 deletions

File tree

internal/cli/quickstarts.go

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -753,20 +753,20 @@ func setupQuickstartCmdExperimental(cli *cli) *cobra.Command {
753753

754754
func printClientDetails(client *management.Client, port int, configFileLocation string, isAPI bool) {
755755
if isAPI {
756-
// Print API-related messages.
756+
// Print API-related messages.
757757
fmt.Printf(" An API application \"%s\" has been created and registered\n\n", *client.Name)
758758
fmt.Println(" You can manage your API from here:")
759759
fmt.Printf(" https://manage.auth0.com/dashboard/#/apis/%s/settings\n", client.GetClientID())
760760
} else {
761-
// Print application-related messages.
761+
// Print application-related messages.
762762
fmt.Printf(" An application \"%s\" has been created in the management console\n", *client.Name)
763763
fmt.Printf(" Client ID: %s\n\n", client.GetClientID())
764764

765-
// Print management console link.
765+
// Print management console link.
766766
fmt.Println(" You can manage your application from here:")
767767
fmt.Printf(" https://manage.auth0.com/dashboard/#/applications/%s/settings\n\n", client.GetClientID())
768768

769-
// Print callback URLs.
769+
// Print callback URLs.
770770
if client.Callbacks != nil && len(client.GetCallbacks()) > 0 {
771771
fmt.Println(" Callback URLs registered in Auth0 Dashboard:")
772772
for _, callback := range client.GetCallbacks() {
@@ -775,7 +775,7 @@ func printClientDetails(client *management.Client, port int, configFileLocation
775775
fmt.Println()
776776
}
777777

778-
// Print logout URLs.
778+
// Print logout URLs.
779779
if client.AllowedLogoutURLs != nil && len(client.GetAllowedLogoutURLs()) > 0 {
780780
fmt.Println("✓ Logout URLs registered:")
781781
for _, logoutURL := range client.GetAllowedLogoutURLs() {
@@ -784,7 +784,7 @@ func printClientDetails(client *management.Client, port int, configFileLocation
784784
fmt.Println()
785785
}
786786

787-
// Print config file location.
787+
// Print config file location.
788788
fmt.Printf("✓ Config file created: %s\n\n", configFileLocation)
789789
}
790790
}
@@ -864,9 +864,9 @@ func getQuickstartConfigKey(inputs struct {
864864
}
865865
}
866866

867-
// Handle application creation inputs.
867+
// Handle application creation inputs.
868868
if inputs.App {
869-
// Prompt for --type if not provided.
869+
// Prompt for --type if not provided.
870870
if inputs.Type == "" {
871871
types := []string{"spa", "regular", "native", "m2m"}
872872
q := prompt.SelectInput("type", "Select the application type", "", types, "m2m", true)
@@ -875,7 +875,7 @@ func getQuickstartConfigKey(inputs struct {
875875
}
876876
}
877877

878-
// Prompt for --framework if not provided.
878+
// Prompt for --framework if not provided.
879879
if inputs.Framework == "" {
880880
frameworks := []string{"react", "angular", "vue", "svelte", "nextjs", "nuxt", "flutter", "express", "django", "spring-boot", "none"}
881881
q := prompt.SelectInput("framework", "Select the framework", "", frameworks, "none", true)
@@ -884,7 +884,7 @@ func getQuickstartConfigKey(inputs struct {
884884
}
885885
}
886886

887-
// Prompt for --build-tool if not provided (optional).
887+
// Prompt for --build-tool if not provided (optional).
888888
if inputs.BuildTool == "" {
889889
buildTools := []string{"vite", "webpack", "cra", "none"}
890890
q := prompt.SelectInput("build-tool", "Select the build tool (optional)", "", buildTools, "none", false)
@@ -894,9 +894,9 @@ func getQuickstartConfigKey(inputs struct {
894894
}
895895
}
896896

897-
// Handle API creation inputs.
897+
// Handle API creation inputs.
898898
if inputs.API {
899-
// Prompt for --identifier or --audience if not provided.
899+
// Prompt for --identifier or --audience if not provided.
900900
if inputs.Identifier == "" && inputs.Audience == "" {
901901
// Name, message, help, defaultValue, required.
902902
q := prompt.TextInput("identifier", "Enter the API identifier (or audience)", "", "", true)
@@ -905,12 +905,12 @@ func getQuickstartConfigKey(inputs struct {
905905
}
906906
}
907907

908-
// Use --audience as an alias for --identifier if provided.
908+
// Use --audience as an alias for --identifier if provided.
909909
if inputs.Identifier == "" {
910910
inputs.Identifier = inputs.Audience
911911
}
912912

913-
// Prompt for --signing-alg if not provided.
913+
// Prompt for --signing-alg if not provided.
914914
if inputs.SigningAlg == "" {
915915
signingAlgs := []string{"RS256", "PS256", "HS256"}
916916
q := prompt.SelectInput("signing-alg", "Select the signing algorithm", "", signingAlgs, "RS256", true)
@@ -919,15 +919,15 @@ func getQuickstartConfigKey(inputs struct {
919919
}
920920
}
921921

922-
// Prompt for --scopes if not provided.
922+
// Prompt for --scopes if not provided.
923923
if inputs.Scopes == "" {
924924
q := prompt.TextInput("scopes", "Enter the scopes (comma-separated)", "", "", false)
925925
if err := prompt.AskOne(q, &inputs.Scopes); err != nil {
926926
return "", inputs, fmt.Errorf("failed to enter scopes: %v", err)
927927
}
928928
}
929929

930-
// Prompt for --token-lifetime if not provided.
930+
// Prompt for --token-lifetime if not provided.
931931
if inputs.TokenLifetime == "" {
932932
q := prompt.TextInput("token-lifetime", "Enter the token lifetime (in seconds)", "", "86400", true)
933933
if err := prompt.AskOne(q, &inputs.TokenLifetime); err != nil {
@@ -940,7 +940,7 @@ func getQuickstartConfigKey(inputs struct {
940940
}
941941
}
942942

943-
// Fallback to "none" if build tool wasn't asked/selected to match the config map keys.
943+
// Fallback to "none" if build tool wasn't asked/selected to match the config map keys.
944944
buildToolKey := inputs.BuildTool
945945
if buildToolKey == "" {
946946
buildToolKey = "none"
@@ -969,7 +969,7 @@ func generateClients(input struct {
969969
OfflineAccess bool
970970
MetaData map[string]interface{}
971971
}, reqParams auth0.RequestParams) ([]*management.Client, error) {
972-
// Prompt for the Name field if missing.
972+
// Prompt for the Name field if missing.
973973

974974
if input.Name == "" {
975975
input.Name = "My App"
@@ -980,7 +980,7 @@ func generateClients(input struct {
980980
return nil, fmt.Errorf("failed to enter application name: %v", err)
981981
}
982982

983-
// Default values for the client.
983+
// Default values for the client.
984984
input.SigningAlg = "RS256"
985985
if input.MetaData == nil {
986986
input.MetaData = map[string]interface{}{
@@ -989,7 +989,7 @@ func generateClients(input struct {
989989
}
990990

991991
oidcConformant := true
992-
// Create the base client.
992+
// Create the base client.
993993
baseClient := &management.Client{
994994
Name: &input.Name,
995995
AppType: &reqParams.AppType,
@@ -1002,11 +1002,11 @@ func generateClients(input struct {
10021002
ClientMetadata: &input.MetaData,
10031003
}
10041004

1005-
// Generate the list of clients.
1005+
// Generate the list of clients.
10061006
var clients []*management.Client
10071007
clients = append(clients, baseClient)
10081008

1009-
// Add an additional client if both App and Api are true.
1009+
// Add an additional client if both App and Api are true.
10101010
if input.API {
10111011
resourceServerAppType := "resource_server"
10121012
q := prompt.TextInput("api_identifier", "Enter API identifier(audience)", "", "", true)
@@ -1031,59 +1031,59 @@ func generateClients(input struct {
10311031
}
10321032

10331033
func replaceDetectionSub(envValues map[string]string, tenantDomain string, client *management.Client) map[string]string {
1034-
// Create a new map to store the updated values.
1034+
// Create a new map to store the updated values.
10351035
updatedEnvValues := make(map[string]string)
10361036

10371037
for key, value := range envValues {
1038-
// If the value is not DETECTION_SUB, keep it as is and continue.
1038+
// If the value is not DETECTION_SUB, keep it as is and continue.
10391039
if value != "DETECTION_SUB" {
10401040
updatedEnvValues[key] = value
10411041
continue
10421042
}
10431043

1044-
// Group keys by the type of replacement they require.
1044+
// Group keys by the type of replacement they require.
10451045
switch key {
10461046
// ==========================================.
10471047
case "VITE_AUTH0_DOMAIN", "AUTH0_DOMAIN", "domain", "NUXT_AUTH0_DOMAIN",
10481048
"auth0.domain", "Auth0:Domain", "auth0:Domain", "auth0_domain",
10491049
"EXPO_PUBLIC_AUTH0_DOMAIN":
10501050
updatedEnvValues[key] = tenantDomain
10511051

1052-
// Express SDK specifically requires the https:// prefix.
1052+
// Express SDK specifically requires the https:// prefix.
10531053
case "ISSUER_BASE_URL":
10541054
updatedEnvValues[key] = "https://" + tenantDomain
10551055

1056-
// Spring Boot okta issuer specifically requires https:// and a trailing slash.
1056+
// Spring Boot okta issuer specifically requires https:// and a trailing slash.
10571057
case "okta.oauth2.issuer":
10581058
updatedEnvValues[key] = "https://" + tenantDomain + "/"
10591059

1060-
// ==========================================.
1060+
// ==========================================.
10611061
case "VITE_AUTH0_CLIENT_ID", "AUTH0_CLIENT_ID", "clientId", "NUXT_AUTH0_CLIENT_ID",
10621062
"CLIENT_ID", "auth0.clientId", "okta.oauth2.client-id", "Auth0:ClientId",
10631063
"auth0:ClientId", "auth0_client_id", "EXPO_PUBLIC_AUTH0_CLIENT_ID":
10641064
updatedEnvValues[key] = client.GetClientID()
10651065

1066-
// ==========================================.
1066+
// ==========================================.
10671067
case "AUTH0_CLIENT_SECRET", "NUXT_AUTH0_CLIENT_SECRET", "auth0.clientSecret",
10681068
"okta.oauth2.client-secret", "Auth0:ClientSecret", "auth0:ClientSecret",
10691069
"auth0_client_secret":
10701070
updatedEnvValues[key] = client.GetClientSecret()
10711071

1072-
// ==========================================.
1072+
// ==========================================.
10731073
case "AUTH0_SECRET", "NUXT_AUTH0_SESSION_SECRET", "SESSION_SECRET",
10741074
"SECRET", "AUTH0_SESSION_ENCRYPTION_KEY", "AUTH0_COOKIE_SECRET":
10751075
// Inject a dummy secret placeholder for the user to replace,
10761076
// or replace this string with a crypto/rand generator if preferred.
10771077
updatedEnvValues[key] = "a_long_random_secret_string_replace_me"
10781078

1079-
// ==========================================.
1079+
// ==========================================.
10801080
case "APP_BASE_URL", "NUXT_AUTH0_APP_BASE_URL", "BASE_URL":
1081-
updatedEnvValues[key] = "http://localhost:3000" updatedEnvValues[key] = "http://localhost:3000" // Default backend port.
1081+
updatedEnvValues[key] = "http://localhost:3000"
10821082

10831083
case "AUTH0_REDIRECT_URI", "AUTH0_CALLBACK_URL":
10841084
updatedEnvValues[key] = "http://localhost:3000/callback"
10851085

1086-
// ==========================================.
1086+
// ==========================================.
10871087
default:
10881088
updatedEnvValues[key] = value
10891089
}
@@ -1100,24 +1100,24 @@ func replaceDetectionSub(envValues map[string]string, tenantDomain string, clien
11001100
// and writes them to the appropriate file in the Current Working Directory (CWD).
11011101
// It returns the generated file name, the file path, and an error (if any).
11021102
func GenerateAndWriteQuickstartConfig(strategy *auth0.FileOutputStrategy, envValues map[string]string, tenantDomain string, client *management.Client) (string, string, error) {
1103-
// 1. Resolve the environment variables using the previously defined function.
1103+
// 1. Resolve the environment variables using the previously defined function.
11041104
resolvedEnv := replaceDetectionSub(envValues, tenantDomain, client)
11051105

1106-
// 2. Determine output file path and format.
1106+
// 2. Determine output file path and format.
11071107
if strategy == nil {
1108-
// Fallback to a standard .env in the project root if for some reason it's missing.
1108+
// Fallback to a standard .env in the project root if for some reason it's missing.
11091109
strategy = &auth0.FileOutputStrategy{Path: ".env", Format: "dotenv"}
11101110
}
11111111

1112-
// 3. Ensure the directory path exists (e.g., creating src/environments/ if it doesn't exist).
1112+
// 3. Ensure the directory path exists (e.g., creating src/environments/ if it doesn't exist).
11131113
dir := filepath.Dir(strategy.Path)
11141114
if dir != "." {
11151115
if err := os.MkdirAll(dir, 0755); err != nil {
11161116
return "", "", fmt.Errorf("failed to create directory structure %s: %w", dir, err)
11171117
}
11181118
}
11191119

1120-
// 4. Format the file content based on the target framework's requirement.
1120+
// 4. Format the file content based on the target framework's requirement.
11211121
var contentBuilder strings.Builder
11221122

11231123
switch strategy.Format {
@@ -1146,10 +1146,10 @@ func GenerateAndWriteQuickstartConfig(strategy *auth0.FileOutputStrategy, envVal
11461146
contentBuilder.WriteString("};\n")
11471147

11481148
case "json":
1149-
// C# appsettings.json expects nested JSON: {"Auth0": {"Domain": "...", "ClientId": "..."}}.
1149+
// C# appsettings.json expects nested JSON: {"Auth0": {"Domain": "...", "ClientId": "..."}}.
11501150
auth0Section := make(map[string]string)
11511151
for key, val := range resolvedEnv {
1152-
// Strip the "Auth0:" prefix used in the map to create clean JSON keys.
1152+
// Strip the "Auth0:" prefix used in the map to create clean JSON keys.
11531153
cleanKey := strings.TrimPrefix(key, "Auth0:")
11541154
auth0Section[cleanKey] = val
11551155
}
@@ -1165,7 +1165,7 @@ func GenerateAndWriteQuickstartConfig(strategy *auth0.FileOutputStrategy, envVal
11651165
contentBuilder.Write(bytes)
11661166

11671167
case "xml":
1168-
// ASP.NET OWIN Web.config.
1168+
// ASP.NET OWIN Web.config.
11691169
contentBuilder.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
11701170
contentBuilder.WriteString("<configuration>\n")
11711171
contentBuilder.WriteString(" <appSettings>\n")
@@ -1176,12 +1176,12 @@ func GenerateAndWriteQuickstartConfig(strategy *auth0.FileOutputStrategy, envVal
11761176
contentBuilder.WriteString("</configuration>\n")
11771177
}
11781178

1179-
// 5. Write the generated content to disk.
1179+
// 5. Write the generated content to disk.
11801180
if err := os.WriteFile(strategy.Path, []byte(contentBuilder.String()), 0600); err != nil {
11811181
return "", "", fmt.Errorf("failed to write config file %s: %w", strategy.Path, err)
11821182
}
11831183

1184-
// 6. Extract the base file name from the path and return both.
1184+
// 6. Extract the base file name from the path and return both.
11851185
fileName := filepath.Base(strategy.Path)
11861186

11871187
return fileName, strategy.Path, nil

0 commit comments

Comments
 (0)