2 Commits

103
README.md
View File

@@ -113,26 +113,19 @@ Inside the container, all devkitARM tools are available in PATH. Run `make` to b
For testing with real Nextcloud servers, copy the example configuration: For testing with real Nextcloud servers, copy the example configuration:
```bash ```bash
cp config.example.json config.json cp config.example config
``` ```
Edit `config.json` and add your test Nextcloud credentials: Edit `config` and add your test Nextcloud credentials:
```json ```ini
{ # Local test configuration - DO NOT COMMIT THIS FILE
"nextcloud": { NEXTCLOUD_URL=https://your-nextcloud-instance.com
"url": "https://your-nextcloud-instance.com", NEXTCLOUD_USER=your-username
"username": "your-username", NEXTCLOUD_PASSWORD=your-password
"password": "your-app-password"
},
"settings": {
"maxRecentFolders": 5,
"uploadChunkSize": 10485760
}
}
``` ```
**Note**: The `config.json` file is in `.gitignore` and will never be committed. **Note**: The `config` file is in `.gitignore` and will never be committed.
## 🔧 Building ## 🔧 Building
@@ -168,71 +161,31 @@ Platform-specific build instructions:
### Local Development Configuration ### Local Development Configuration
The project uses a JSON configuration file for managing test credentials and build options. The `config` file (copied from `config.example`) is used for local testing:
**Setup:** ```ini
```bash NEXTCLOUD_URL=https://cloud.example.com
# Copy the example configuration NEXTCLOUD_USER=testuser
cp config.example.json config.json NEXTCLOUD_PASSWORD=testpass
MAX_RECENT_FOLDERS=5 # Build-time option
# Edit config.json with your credentials
nano config.json
``` ```
**Configuration structure:** ### CI/CD Environment Variables
```json
{ For CI/CD pipelines, use environment variables to override the local config:
"nextcloud": {
"url": "https://cloud.example.com", - `NEXTCLOUD_TEST_URL` - Test server URL
"username": "testuser", - `NEXTCLOUD_TEST_USER` - Test username
"password": "your-app-password" - `NEXTCLOUD_TEST_PASSWORD` - Test password
}, - `MAX_RECENT_FOLDERS` - Number of recent folders to track
"settings": {
"maxRecentFolders": 5, Example:
"uploadChunkSize": 10485760
}
}
```
**Loading configuration:**
```bash ```bash
# Load configuration and export as environment variables NEXTCLOUD_TEST_URL=https://cloud.tomusan.com \
source scripts/load-config.sh NEXTCLOUD_TEST_USER=ci-user \
NEXTCLOUD_TEST_PASSWORD=ci-pass \
# Validate configuration podman run --rm -v ./:/project:z nextcloud-share-3ds make
./scripts/validate-config.sh
```
### Environment Variable Overrides
Environment variables take precedence over JSON configuration values. This is useful for CI/CD pipelines where you don't want to store credentials in files.
**Supported environment variables:**
- `NEXTCLOUD_URL` - Nextcloud server URL (required)
- `NEXTCLOUD_USER` - Username for authentication (required)
- `NEXTCLOUD_PASSWORD` - Password or app password (required)
- `MAX_RECENT_FOLDERS` - Number of recent folders to track (default: 5)
- `UPLOAD_CHUNK_SIZE` - Upload chunk size in bytes (default: 10485760)
- `CONFIG_FILE` - Path to config file (default: config.json)
**CI/CD Example:**
```bash
# Override configuration with environment variables
export NEXTCLOUD_URL=https://cloud.tomusan.com
export NEXTCLOUD_USER=ci-user
export NEXTCLOUD_PASSWORD=ci-pass
# Load any remaining config from file
source scripts/load-config.sh
# Run tests
podman run --rm \
-e NEXTCLOUD_URL \
-e NEXTCLOUD_USER \
-e NEXTCLOUD_PASSWORD \
-v ./:/project:z \
tomusan/devkitarm-3ds:latest \
make test
``` ```
## 🧪 Testing ## 🧪 Testing