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
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,32 @@ flashduty field list [flags] # List custom field definitions

Supports `--name`.

### `statuspage` - Status Page Management (4 commands)
### `statuspage` - Status Page Management (5 command groups)

```bash
flashduty statuspage list [--id <ids>] # List status pages
flashduty statuspage changes --page-id <id> --type <incident|maintenance> # List active changes
flashduty statuspage create-incident --page-id <id> --title <title> # Create status incident
flashduty statuspage create-timeline --page-id <id> --change <id> --message <msg> # Add timeline update
flashduty statuspage migrate structure --from atlassian --source-page-id <id> --api-key <key> # Start structure/history migration
flashduty statuspage migrate email-subscribers --from atlassian --source-page-id <id> --target-page-id <id> --api-key <key> # Start email subscriber migration
flashduty statuspage migrate status --job-id <id> # Check migration job status
flashduty statuspage migrate cancel --job-id <id> # Cancel a running migration job
```

Migration jobs are asynchronous. After starting `structure` or `email-subscribers`, use:

```bash
flashduty statuspage migrate status --job-id <job_id>
```

Typical flow:

```bash
flashduty statuspage migrate structure --from atlassian --source-page-id page_123 --api-key $ATLASSIAN_STATUSPAGE_API_KEY
flashduty statuspage migrate status --job-id <structure_job_id>
flashduty statuspage migrate email-subscribers --from atlassian --source-page-id page_123 --target-page-id <target_page_id> --api-key $ATLASSIAN_STATUSPAGE_API_KEY
flashduty statuspage migrate status --job-id <subscriber_job_id>
```

### `template` - Notification Template Management (4 commands)
Expand Down
25 changes: 17 additions & 8 deletions internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,11 @@ func newClient() (flashdutyClient, error) {

// defaultNewClient creates a real Flashduty SDK client from resolved config + flag overrides.
func defaultNewClient() (flashdutyClient, error) {
cfg, err := config.Load()
cfg, err := loadResolvedConfig()
if err != nil {
return nil, err
}

if flagAppKey != "" {
cfg.AppKey = flagAppKey
}
if flagBaseURL != "" {
cfg.BaseURL = flagBaseURL
}

if cfg.AppKey == "" {
return nil, fmt.Errorf("no app key configured. Run 'flashduty login' or set FLASHDUTY_APP_KEY")
}
Expand All @@ -160,6 +153,22 @@ func defaultNewClient() (flashdutyClient, error) {
return flashduty.NewClient(cfg.AppKey, opts...)
}

func loadResolvedConfig() (*config.Config, error) {
cfg, err := config.Load()
if err != nil {
return nil, err
}

if flagAppKey != "" {
cfg.AppKey = flagAppKey
}
if flagBaseURL != "" {
cfg.BaseURL = flagBaseURL
}

return cfg, nil
}

// newPrinter creates a Printer based on global flags.
func newPrinter(w io.Writer) output.Printer {
if w == nil {
Expand Down
1 change: 1 addition & 0 deletions internal/cli/status_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func newStatusPageCmd() *cobra.Command {
cmd.AddCommand(newStatusPageChangesCmd())
cmd.AddCommand(newStatusPageCreateIncidentCmd())
cmd.AddCommand(newStatusPageCreateTimelineCmd())
cmd.AddCommand(newStatusPageMigrateCmd())
return cmd
}

Expand Down
Loading
Loading