fix: Clean up Quick Setup — remove NATS_TOKEN, auto-populate license key
NATS has no auth configured, so NATS_TOKEN was a placeholder that confused users. Made it optional in the Go agent (default empty) and removed it from Quick Setup commands. Also removed GAME_SERVER_PATH since one-click deploy handles server installation. License key already auto-populates from auth store after previous commit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
type Config struct {
|
||||
// NATS connection
|
||||
NATSUrl string `envconfig:"NATS_URL" required:"true"`
|
||||
NATSToken string `envconfig:"NATS_TOKEN" required:"true"`
|
||||
NATSToken string `envconfig:"NATS_TOKEN" default:""`
|
||||
|
||||
// License identification
|
||||
LicenseID string `envconfig:"LICENSE_ID" required:"true"`
|
||||
|
||||
@@ -7,13 +7,12 @@ import (
|
||||
"github.com/nats-io/nats.go"
|
||||
)
|
||||
|
||||
// Connect establishes a connection to NATS with token authentication
|
||||
// Connect establishes a connection to NATS with optional token authentication
|
||||
// and automatic reconnection handling
|
||||
func Connect(url, token string) (*nats.Conn, error) {
|
||||
opts := []nats.Option{
|
||||
nats.Token(token),
|
||||
nats.Name("corrosion-companion"),
|
||||
nats.MaxReconnects(-1), // Unlimited reconnect attempts
|
||||
nats.MaxReconnects(-1),
|
||||
nats.ReconnectWait(2 * time.Second),
|
||||
nats.DisconnectErrHandler(func(nc *nats.Conn, err error) {
|
||||
if err != nil {
|
||||
@@ -31,6 +30,11 @@ func Connect(url, token string) (*nats.Conn, error) {
|
||||
}),
|
||||
}
|
||||
|
||||
// Only use token auth if a token is provided
|
||||
if token != "" {
|
||||
opts = append(opts, nats.Token(token))
|
||||
}
|
||||
|
||||
nc, err := nats.Connect(url, opts...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to connect to NATS: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user