Skip to content

make compose config login optional#1898

Closed
KevyVo wants to merge 1 commit intomainfrom
kevin/config
Closed

make compose config login optional#1898
KevyVo wants to merge 1 commit intomainfrom
kevin/config

Conversation

@KevyVo
Copy link
Contributor

@KevyVo KevyVo commented Feb 3, 2026

Description

When running defang compose config, there is an panic because the user needs to be login which is not needed. If we have the stack we use it, if not we should be able to continue.

panic:

./samples/agentic-autogen/compose.yaml is not valid according to `defang compose config`:   ! unable to load stack: unauthenticated: missing bearer token - some information may not be up-to-date
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x2a5de9d]

goroutine 1 [running]:
main.main.func1()
	github.com/DefangLabs/defang/src/cmd/cli/main.go:22 +0x145
panic({0x3129680?, 0x5fe2db0?})
	runtime/panic.go:792 +0x132
github.com/DefangLabs/defang/src/cmd/cli/command.setupComposeCommand.makeComposeConfigCmd.func1(0xc000572908, {0x607aa60?, 0x0?, 0x0?})
	github.com/DefangLabs/defang/src/cmd/cli/command/compose.go:553 +0xdd
github.com/spf13/cobra.(*Command).execute(0xc000572908, {0x607aa60, 0x0, 0x0})
	github.com/spf13/cobra@v1.8.0/command.go:1015 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0x603a4e0)
	github.com/spf13/cobra@v1.8.0/command.go:1148 +0x46f
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.8.0/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	github.com/spf13/cobra@v1.8.0/command.go:1064
github.com/DefangLabs/defang/src/cmd/cli/command.Execute({0x41c19f8, 0xc000425540})
	github.com/DefangLabs/defang/src/cmd/cli/command/commands.go:48 +0xd1
main.main()
	github.com/DefangLabs/defang/src/cmd/cli/main.go:36 +0x13a

Discover in this PR test: DefangLabs/samples#618

Linked Issues

Checklist

  • I have performed a self-review of my code
  • I have added appropriate tests
  • I have updated the Defang CLI docs and/or README to reflect my changes, if necessary

Summary by CodeRabbit

Release Notes

  • New Features
    • Added local-only mode for compose operations. Compose config and compose up commands now work without server authentication, with automatic fallback to local mode when authentication is unavailable.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

Introduces a local-only provider to enable compose operations without server authentication. Adds fallback mechanism in compose commands that switches to local-only mode using a minimal loader when cloud session initialization fails, while maintaining existing behavior for successful authentication paths.

Changes

Cohort / File(s) Summary
Local-Only Compose Provider
src/cmd/cli/command/compose.go
Introduces localOnlyProvider implementation with DNS and domain methods, adds fallback logic in compose config and up commands to initialize loader/provider/stack from command flags when authentication fails, and wires resolved provider/stack into subsequent operations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • lionello

Poem

🐰 A compose that hops both near and far,
With auth or without, we'll go just as we are,
Local-only magic when clouds drift away,
The rabbit builds bridges in every which way! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'make compose config login optional' accurately captures the main objective: enabling compose config operations without requiring authentication.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kevin/config

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

level=warning msg="[linters_context] running gomodguard failed: unable to read module file go.mod: current working directory must have a go.mod file: if you are not using go modules it is suggested to disable this linter"
level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands and usage tips.

@lionello
Copy link
Member

lionello commented Feb 3, 2026

Closed in favor of #1901

@lionello lionello closed this Feb 3, 2026
@lionello lionello deleted the kevin/config branch February 3, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants