-
Notifications
You must be signed in to change notification settings - Fork 0
fix(config): make endpoints optional and use relative schema path #175
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -45,7 +45,7 @@ func commandAuth(c *cli.Context) error { | |||||
| SetupLogger(configDir) | ||||||
|
|
||||||
| // Generate JSON schema for IDE autocompletion | ||||||
| schemaFile := configDir + "/config.schema.json" | ||||||
| schemaFile := configDir + "/config-schema.json" | ||||||
| if err := generateSchemaFile(schemaFile); err != nil { | ||||||
| slog.Warn("Failed to generate schema file", slog.Any("err", err)) | ||||||
| } | ||||||
|
|
@@ -58,7 +58,7 @@ func commandAuth(c *cli.Context) error { | |||||
| return fmt.Errorf("failed to marshal default config: %w", err) | ||||||
| } | ||||||
| // Prepend $schema for IDE autocompletion support | ||||||
| schemaHeader := "# yaml-language-server: $schema=" + schemaFile + "\n" | ||||||
| schemaHeader := "# yaml-language-server: $schema=./config-schema.json\n" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The schema filename This will require importing the
Suggested change
|
||||||
| content = append([]byte(schemaHeader), content...) | ||||||
| err = os.WriteFile(configFile, content, 0644) | ||||||
| if err != nil { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -60,7 +60,7 @@ type ShellTimeConfig struct { | |||||
| DataMasking *bool `toml:"dataMasking" yaml:"dataMasking" json:"dataMasking"` | ||||||
|
|
||||||
| // for debug purpose | ||||||
| Endpoints []Endpoint `toml:"ENDPOINTS" yaml:"endpoints" json:"endpoints"` | ||||||
| Endpoints []Endpoint `toml:"ENDPOINTS,omitempty" yaml:"endpoints,omitempty" json:"endpoints,omitempty"` | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The TOML tag
Suggested change
|
||||||
|
|
||||||
| // WARNING | ||||||
| // This config will track each command metrics you run in current shell. | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure platform-independent path construction, you should use
filepath.Joininstead of string concatenation with/. This will prevent potential issues on operating systems like Windows that use a different path separator. This follows the repository's general rule for path handling.You'll need to add
"path/filepath"to your imports.References
filepath.Jointo combine path segments for platform independence, rather than hardcoding path separators.