Skip to content

Commit 4305852

Browse files
Remove project_id config option and global flag (#74)
1 parent a334bab commit 4305852

24 files changed

+768
-1001
lines changed

CLAUDE.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ Key configuration values:
179179
- `gateway_url`: Tiger Gateway URL
180180
- `docs_mcp`: Enable/disable proxied docs MCP tools
181181
- `docs_mcp_url`: URL for docs MCP server
182-
- `project_id`: Default project ID
183182
- `service_id`: Default service ID
184183
- `output`: Output format (json, yaml, table)
185184
- `analytics`: Usage analytics toggle
@@ -271,7 +270,6 @@ Global flags available on all commands:
271270
- `--config-dir`: Path to configuration directory
272271
- `--debug`: Enable debug logging
273272
- `--output/-o`: Set output format
274-
- `--project-id`: Override project ID
275273
- `--service-id`: Override service ID
276274
- `--analytics`: Toggle analytics
277275
- `--password-storage`: Password storage method
@@ -405,7 +403,6 @@ func buildRootCmd() *cobra.Command {
405403
// Declare ALL flag variables locally within this function
406404
var configDir string
407405
var debug bool
408-
var projectID string
409406
var serviceID string
410407
var analytics bool
411408
var passwordStorage string
@@ -428,7 +425,6 @@ func buildRootCmd() *cobra.Command {
428425
cobra.OnInitialize(initConfigFunc)
429426
cmd.PersistentFlags().StringVar(&configDir, "config-dir", config.GetDefaultConfigDir(), "config directory")
430427
cmd.PersistentFlags().BoolVar(&debug, "debug", false, "enable debug logging")
431-
cmd.PersistentFlags().StringVar(&projectID, "project-id", "", "project ID")
432428
cmd.PersistentFlags().StringVar(&serviceID, "service-id", "", "service ID")
433429
cmd.PersistentFlags().BoolVar(&analytics, "analytics", true, "enable/disable usage analytics")
434430
cmd.PersistentFlags().StringVar(&passwordStorage, "password-storage", config.DefaultPasswordStorage, "password storage method (keyring, pgpass, none)")

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Tiger CLI provides the following commands:
8080
- `tiger auth` - Authentication management
8181
- `login` - Log in to your Tiger account
8282
- `logout` - Log out from your Tiger account
83-
- `status` - Show current authentication status
83+
- `status` - Show current authentication status and project ID
8484
- `tiger service` - Service lifecycle management
8585
- `list` - List all services
8686
- `create` - Create a new service
@@ -211,7 +211,6 @@ tiger config reset
211211
All configuration options can be set via `tiger config set <key> <value>`:
212212

213213
- `docs_mcp` - Enable/disable docs MCP proxy (default: `true`)
214-
- `project_id` - Default project ID (set via `tiger auth login`)
215214
- `service_id` - Default service ID
216215
- `output` - Output format: `json`, `yaml`, or `table` (default: `table`)
217216
- `analytics` - Enable/disable analytics (default: `true`)
@@ -224,7 +223,6 @@ Environment variables override configuration file values. All variables use the
224223

225224
- `TIGER_CONFIG_DIR` - Path to configuration directory (default: `~/.config/tiger`)
226225
- `TIGER_DOCS_MCP` - Enable/disable docs MCP proxy
227-
- `TIGER_PROJECT_ID` - Default project ID
228226
- `TIGER_SERVICE_ID` - Default service ID
229227
- `TIGER_OUTPUT` - Output format: `json`, `yaml`, or `table`
230228
- `TIGER_ANALYTICS` - Enable/disable analytics
@@ -238,7 +236,6 @@ Environment variables override configuration file values. All variables use the
238236
These flags are available on all commands and take precedence over both environment variables and configuration file values:
239237

240238
- `--config-dir <path>` - Path to configuration directory (default: `~/.config/tiger`)
241-
- `--project-id <id>` - Specify project ID
242239
- `--service-id <id>` - Specify service ID
243240
- `--analytics` - Enable/disable analytics
244241
- `--password-storage <method>` - Password storage method: `keyring`, `pgpass`, or `none`

internal/tiger/cmd/auth.go

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,11 @@ Examples:
126126
return fmt.Errorf("API key validation failed: %w", err)
127127
}
128128

129-
// Store the API key securely
130-
if err := config.StoreAPIKey(apiKey); err != nil {
131-
return fmt.Errorf("failed to store API key: %w", err)
129+
// Store the credentials (API key + project ID) together securely
130+
if err := config.StoreCredentials(apiKey, creds.projectID); err != nil {
131+
return fmt.Errorf("failed to store credentials: %w", err)
132132
}
133-
fmt.Fprintln(cmd.OutOrStdout(), "Successfully logged in and stored API key")
134-
135-
// Store project ID in config if provided
136-
if err := storeProjectID(creds.projectID); err != nil {
137-
return fmt.Errorf("failed to store project ID: %w", err)
138-
}
139-
fmt.Fprintf(cmd.OutOrStdout(), "Set default project ID to: %s\n", creds.projectID)
133+
fmt.Fprintf(cmd.OutOrStdout(), "Successfully logged in (project: %s)\n", creds.projectID)
140134

141135
// Show helpful next steps
142136
fmt.Fprint(cmd.OutOrStdout(), nextStepsMessage)
@@ -161,8 +155,8 @@ func buildLogoutCmd() *cobra.Command {
161155
RunE: func(cmd *cobra.Command, args []string) error {
162156
cmd.SilenceUsage = true
163157

164-
if err := config.RemoveAPIKey(); err != nil {
165-
return fmt.Errorf("failed to remove API key: %w", err)
158+
if err := config.RemoveCredentials(); err != nil {
159+
return fmt.Errorf("failed to remove credentials: %w", err)
166160
}
167161

168162
fmt.Fprintln(cmd.OutOrStdout(), "Successfully logged out and removed stored credentials")
@@ -174,17 +168,19 @@ func buildLogoutCmd() *cobra.Command {
174168
func buildStatusCmd() *cobra.Command {
175169
return &cobra.Command{
176170
Use: "status",
177-
Short: "Show current auth information",
178-
Long: `Show information about the currently authenticated token.`,
171+
Short: "Show current authentication status and project ID",
172+
Long: "Displays whether you are logged in and shows your currently configured project ID.",
179173
RunE: func(cmd *cobra.Command, args []string) error {
180174
cmd.SilenceUsage = true
181175

182-
if _, err := config.GetAPIKey(); err != nil {
176+
_, projectID, err := config.GetCredentials()
177+
if err != nil {
183178
return err
184179
}
185180

186181
// TODO: Make API call to get token information
187182
fmt.Fprintln(cmd.OutOrStdout(), "Logged in (API key stored)")
183+
fmt.Fprintf(cmd.OutOrStdout(), "Project ID: %s\n", projectID)
188184

189185
return nil
190186
},
@@ -256,13 +252,3 @@ func promptForCredentials(consoleURL string, creds credentials) (credentials, er
256252

257253
return creds, nil
258254
}
259-
260-
// storeProjectID stores the project ID in the configuration file
261-
func storeProjectID(projectID string) error {
262-
cfg, err := config.Load()
263-
if err != nil {
264-
return fmt.Errorf("failed to load config: %w", err)
265-
}
266-
267-
return cfg.Set("project_id", projectID)
268-
}

0 commit comments

Comments
 (0)