Skip to content

Commit fa4358a

Browse files
Merge pull request #42 from joshrotenberg/feat/auth-improvements-issue-33
feat: Add auth test, config management, and interactive setup wizard
2 parents 9a91e9b + fa4e4eb commit fa4358a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+2318
-174
lines changed

README.md

Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,35 +144,76 @@ docker compose down -v
144144

145145
### 1. Configure Authentication
146146

147-
#### Redis Cloud
147+
#### Option 1: Interactive Setup Wizard (Recommended)
148148
```bash
149-
# Using environment variables
150-
export REDIS_CLOUD_API_KEY="your-api-key"
151-
export REDIS_CLOUD_API_SECRET="your-api-secret"
149+
# Launch guided setup for any deployment type
150+
redisctl auth setup
152151

153-
# Or using profiles
154-
redisctl profile set prod-cloud \
155-
--deployment-type cloud \
156-
--api-key YOUR_KEY \
157-
--api-secret YOUR_SECRET
152+
# Test your authentication
153+
redisctl auth test
158154
```
159155

160-
#### Redis Enterprise
156+
The interactive setup wizard will:
157+
- Guide you through credential collection
158+
- Test authentication during setup
159+
- Create and save working profiles
160+
- Set up your first profile as default
161+
162+
#### Option 2: Manual Profile Creation
163+
164+
##### Redis Cloud
161165
```bash
162-
# Using environment variables
166+
# Create a Cloud profile manually
167+
redisctl profile set prod-cloud cloud \
168+
--api-key "your-api-key" \
169+
--api-secret "your-api-secret"
170+
171+
# Set as default profile
172+
redisctl profile default prod-cloud
173+
```
174+
175+
##### Redis Enterprise
176+
```bash
177+
# Create an Enterprise profile manually
178+
redisctl profile set prod-enterprise enterprise \
179+
--url https://cluster:9443 \
180+
--username [email protected] \
181+
--password your-password
182+
```
183+
184+
#### Option 3: Environment Variables
185+
```bash
186+
# Redis Cloud
187+
export REDIS_CLOUD_API_KEY="your-api-key"
188+
export REDIS_CLOUD_API_SECRET="your-api-secret"
189+
190+
# Redis Enterprise
163191
export REDIS_ENTERPRISE_URL="https://cluster.example.com:9443"
164-
export REDIS_ENTERPRISE_USER="[email protected]"
192+
export REDIS_ENTERPRISE_USER="[email protected]"
165193
export REDIS_ENTERPRISE_PASSWORD="your-password"
166194

167-
# Or using profiles
168-
redisctl profile set prod-enterprise \
169-
--deployment-type enterprise \
170-
--url https://cluster:9443 \
171-
--username admin \
172-
--password secret
195+
# Test authentication works
196+
redisctl auth test
197+
```
198+
199+
### 2. Verify Your Setup
200+
201+
```bash
202+
# Test authentication for any profile or environment vars
203+
redisctl auth test
204+
redisctl auth test --profile prod-cloud
205+
206+
# View your configuration
207+
redisctl config show
208+
209+
# Validate all profiles
210+
redisctl config validate
211+
212+
# Find your config file location
213+
redisctl config path
173214
```
174215

175-
### 2. Basic Usage
216+
### 3. Basic Usage
176217

177218
```bash
178219
# List all profiles
@@ -194,7 +235,7 @@ redisctl database list -o json | jq '.[] | .name'
194235
redisctl database list -q "[?status=='active'].name" -o yaml
195236
```
196237

197-
### 3. Common Workflows
238+
### 4. Common Workflows
198239

199240
```bash
200241
# Initialize a new Enterprise cluster

crates/redisctl/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ serde_json = { workspace = true }
4141
chrono = "0.4"
4242
rpassword = { workspace = true }
4343
urlencoding = "2.1"
44+
dialoguer = "0.11"
45+
colored = "2.1"
4446

4547
# Shared utility dependencies
4648
thiserror = { workspace = true }

crates/redisctl/src/cli.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ pub enum Commands {
6969
#[command(subcommand)]
7070
command: AccountCommands,
7171
},
72+
/// Authentication testing and management
73+
Auth {
74+
#[command(subcommand)]
75+
command: AuthCommands,
76+
},
77+
/// Configuration management
78+
Config {
79+
#[command(subcommand)]
80+
command: ConfigCommands,
81+
},
7282
}
7383

7484
#[derive(Subcommand)]
@@ -1585,3 +1595,36 @@ pub enum BillingCommands {
15851595
data: String,
15861596
},
15871597
}
1598+
1599+
#[derive(Subcommand)]
1600+
pub enum AuthCommands {
1601+
/// Test authentication credentials
1602+
Test {
1603+
/// Profile to test (defaults to current profile)
1604+
#[arg(long)]
1605+
profile: Option<String>,
1606+
/// Test a specific deployment type
1607+
#[arg(long, value_enum)]
1608+
deployment: Option<DeploymentType>,
1609+
},
1610+
/// Interactive setup wizard for new profiles
1611+
Setup,
1612+
}
1613+
1614+
#[derive(Subcommand)]
1615+
pub enum ConfigCommands {
1616+
/// Show current configuration and active profile
1617+
Show {
1618+
/// Show sensitive values (passwords, API keys)
1619+
#[arg(long)]
1620+
show_secrets: bool,
1621+
},
1622+
/// Show configuration file path
1623+
Path,
1624+
/// Validate configuration
1625+
Validate {
1626+
/// Profile to validate (defaults to all profiles)
1627+
#[arg(long)]
1628+
profile: Option<String>,
1629+
},
1630+
}

crates/redisctl/src/cloud_bin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn get_cloud_profile<'a>(
6060
let env_profile = std::env::var("REDISCTL_PROFILE").ok();
6161
let profile_name = profile_name
6262
.as_deref()
63-
.or(config.default.as_deref())
63+
.or(config.default_profile.as_deref())
6464
.or(env_profile.as_deref())
6565
.ok_or_else(|| anyhow::anyhow!("No profile specified"))?;
6666

0 commit comments

Comments
 (0)