Merge pull request 'docs(config): Update README with JSON configuration format' (#24) from setup-build-config-system into develop
Reviewed-on: #24
This commit was merged in pull request #24.
This commit is contained in:
103
README.md
103
README.md
@@ -113,19 +113,26 @@ 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 config
|
cp config.example.json config.json
|
||||||
```
|
```
|
||||||
|
|
||||||
Edit `config` and add your test Nextcloud credentials:
|
Edit `config.json` and add your test Nextcloud credentials:
|
||||||
|
|
||||||
```ini
|
```json
|
||||||
# Local test configuration - DO NOT COMMIT THIS FILE
|
{
|
||||||
NEXTCLOUD_URL=https://your-nextcloud-instance.com
|
"nextcloud": {
|
||||||
NEXTCLOUD_USER=your-username
|
"url": "https://your-nextcloud-instance.com",
|
||||||
NEXTCLOUD_PASSWORD=your-password
|
"username": "your-username",
|
||||||
|
"password": "your-app-password"
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"maxRecentFolders": 5,
|
||||||
|
"uploadChunkSize": 10485760
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note**: The `config` file is in `.gitignore` and will never be committed.
|
**Note**: The `config.json` file is in `.gitignore` and will never be committed.
|
||||||
|
|
||||||
## 🔧 Building
|
## 🔧 Building
|
||||||
|
|
||||||
@@ -161,31 +168,71 @@ Platform-specific build instructions:
|
|||||||
|
|
||||||
### Local Development Configuration
|
### Local Development Configuration
|
||||||
|
|
||||||
The `config` file (copied from `config.example`) is used for local testing:
|
The project uses a JSON configuration file for managing test credentials and build options.
|
||||||
|
|
||||||
```ini
|
**Setup:**
|
||||||
NEXTCLOUD_URL=https://cloud.example.com
|
```bash
|
||||||
NEXTCLOUD_USER=testuser
|
# Copy the example configuration
|
||||||
NEXTCLOUD_PASSWORD=testpass
|
cp config.example.json config.json
|
||||||
MAX_RECENT_FOLDERS=5 # Build-time option
|
|
||||||
|
# Edit config.json with your credentials
|
||||||
|
nano config.json
|
||||||
```
|
```
|
||||||
|
|
||||||
### CI/CD Environment Variables
|
**Configuration structure:**
|
||||||
|
```json
|
||||||
For CI/CD pipelines, use environment variables to override the local config:
|
{
|
||||||
|
"nextcloud": {
|
||||||
- `NEXTCLOUD_TEST_URL` - Test server URL
|
"url": "https://cloud.example.com",
|
||||||
- `NEXTCLOUD_TEST_USER` - Test username
|
"username": "testuser",
|
||||||
- `NEXTCLOUD_TEST_PASSWORD` - Test password
|
"password": "your-app-password"
|
||||||
- `MAX_RECENT_FOLDERS` - Number of recent folders to track
|
},
|
||||||
|
"settings": {
|
||||||
Example:
|
"maxRecentFolders": 5,
|
||||||
|
"uploadChunkSize": 10485760
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Loading configuration:**
|
||||||
```bash
|
```bash
|
||||||
NEXTCLOUD_TEST_URL=https://cloud.tomusan.com \
|
# Load configuration and export as environment variables
|
||||||
NEXTCLOUD_TEST_USER=ci-user \
|
source scripts/load-config.sh
|
||||||
NEXTCLOUD_TEST_PASSWORD=ci-pass \
|
|
||||||
podman run --rm -v ./:/project:z nextcloud-share-3ds make
|
# Validate configuration
|
||||||
|
./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
|
||||||
|
|||||||
Reference in New Issue
Block a user