# Fix Placeholders - Quick Reference Guide

## 🔴 Critical - Must Fix Before Production

### 1. Replace Organization Namespace

**Find and Replace**:
- `proxmox.yourorg.io` → `proxmox.YOURACTUALORG.io`
- `github.com/yourorg` → `github.com/YOURACTUALORG`
- `yourorg` → `YOURACTUALORG`

**Files**:
```bash
# Use find and replace in your editor
grep -r "yourorg" crossplane-provider-proxmox/
grep -r "yourorg" gitops/
grep -r "yourorg" portal/
```

### 2. Replace Domain Placeholders

**Find and Replace**:
- ✅ Updated to use `sankofa.nexus` as the project domain
- Replace with your actual domain in production if different
- `example.com` → `YOURACTUALDOMAIN.com` (in production configs)
- `sankofa.nexus` → `YOURACTUALDOMAIN.com` (if different)

**Files**:
```bash
grep -r "yourdomain\|example.com" docs/
grep -r "sankofa.nexus" api/src/
```

### 3. Update GitOps Repository URL

**File**: `gitops/apps/argocd/application.yaml`
```yaml
source:
  repoURL: https://github.com/YOURACTUALORG/sankofa-phoenix
```

### 4. Implement Credential Handling

**File**: `crossplane-provider-proxmox/pkg/controller/virtualmachine/controller.go`

Replace placeholder credentials (line ~169) with:
```go
func (r *ProxmoxVMReconciler) getCredentials(ctx context.Context, config *proxmoxv1alpha1.ProviderConfig) (*credentials, error) {
    if config.Spec.Credentials.SecretRef == nil {
        return nil, fmt.Errorf("no secret reference in provider config")
    }

    secretRef := config.Spec.Credentials.SecretRef
    
    // Get secret from Kubernetes
    secret := &corev1.Secret{}
    secretKey := client.ObjectKey{
        Namespace: secretRef.Namespace,
        Name:      secretRef.Name,
    }
    
    if err := r.Get(ctx, secretKey, secret); err != nil {
        return nil, errors.Wrap(err, "cannot get secret")
    }
    
    // Parse credentials from secret
    username := string(secret.Data["username"])
    password := string(secret.Data["password"])
    
    if username == "" || password == "" {
        return nil, fmt.Errorf("username or password missing in secret")
    }
    
    return &credentials{
        Username: username,
        Password: password,
    }, nil
}
```

**File**: `crossplane-provider-proxmox/pkg/controller/resourcediscovery/controller.go`

Replace empty credentials (lines ~135, ~164) with proper secret retrieval.

---

## 🟡 Medium Priority

### 5. Replace Console.log with Proper Logging

**Install logging library**:
```bash
cd api
pnpm add winston
pnpm add -D @types/winston
```

**Create logger** (`api/src/lib/logger.ts`):
```typescript
import winston from 'winston'

export const logger = winston.createLogger({
  level: process.env.LOG_LEVEL || 'info',
  format: winston.format.combine(
    winston.format.timestamp(),
    winston.format.json()
  ),
  transports: [
    new winston.transports.Console({
      format: winston.format.simple()
    })
  ]
})
```

**Replace console.log**:
```typescript
// Before
console.log('Message')
console.error('Error', error)

// After
import { logger } from '../lib/logger'
logger.info('Message')
logger.error('Error', { error })
```

### 6. Generate Blockchain Contract Types

**Install typechain**:
```bash
cd blockchain
pnpm add -D @typechain/ethers-v6 typechain
```

**Generate types**:
```bash
pnpm exec typechain --target ethers-v6 --out-dir ../api/src/types/contracts artifacts/contracts/**/*.json
```

**Update blockchain service** to use generated types.

---

## 🟢 Low Priority

### 7. Create Helm Charts

Create `helm/sankofa-phoenix/` with:
- `Chart.yaml`
- `values.yaml`
- `templates/` directory

### 8. Add API Documentation

**Install GraphQL tools**:
```bash
cd api
pnpm add -D @graphql-codegen/cli @graphql-codegen/typescript
```

**Generate types and docs**:
```bash
pnpm exec graphql-codegen
```

---

## ✅ Checklist

- [ ] Replace all `yourorg` references
- [ ] Replace all `yourdomain.com` references  
- [ ] Update GitOps repository URL
- [ ] Implement credential handling in Crossplane
- [ ] Create all `.env.example` files
- [ ] Replace console.log with proper logging
- [ ] Generate blockchain contract types
- [ ] Document error tracking setup
- [ ] Review and test all changes

---

**Note**: Use your IDE's find-and-replace feature for bulk replacements. Always test after making changes.

