MockData Path Configuration Guide¶
Last Updated: 2026-03-28 (verified) Applies To: Cesivi Server 1.0+
Overview¶
The Cesivi Server stores all SharePoint data (lists, libraries, items, files, etc.) in a configurable MockData folder. This folder can be configured via multiple methods to support different development scenarios, multi-working-tree setups, and containerized deployments.
Default Configuration¶
Default Path¶
- On-Premise/Local:
../MockData(relative to Cesivi.Server executable) - Docker Container:
/app/MockData
Default Structure¶
MockData/
├── WebApplications/
│ └── SharePoint-80/
│ └── SiteCollections/
│ └── root/
│ ├── settings.json
│ ├── Lists/
│ │ └── Tasks/
│ │ ├── settings.json
│ │ └── Files/
│ └── Libraries/
│ └── Documents/
│ ├── settings.json
│ └── Files/
├── AD/
│ ├── Users/
│ └── Groups/
├── TermStore/
└── Logs/
└── Server/
Configuration Methods¶
Method 1: appsettings.json (Recommended for Single Instance)¶
File: Cesivi.Server/appsettings.json
{
"Cesivi": {
"DataRootPath": "../MockData",
"LogPath": "../MockData/Logs/Server"
}
}
Pros: - Simple and straightforward - Version-controlled configuration - IDE-friendly
Cons: - Requires file modification - Not suitable for multi-working-tree setups - Cannot be changed without editing file
Usage:
# Edit appsettings.json
cd Cesivi.Server
notepad appsettings.json
# Change DataRootPath:
"DataRootPath": "C:\\MyCustomPath\\MockData",
Method 2: Environment Variables (Recommended for Multi-Working-Tree)¶
Variable: CESIVI__DataRootPath
ASP.NET Core uses double underscore (__) to map environment variables to configuration hierarchy.
Windows PowerShell:
# Set for current session
$env:CESIVI__DataRootPath = "C:\MockData\WorkTree1"
# Start server
dotnet run --project Cesivi.Server
# Or combine in one line
$env:CESIVI__DataRootPath = "C:\MockData\WorkTree1"; dotnet run --project Cesivi.Server
Windows CMD:
set CESIVI__DataRootPath=C:\MockData\WorkTree1
dotnet run --project Cesivi.Server
Linux/macOS:
export CESIVI__DataRootPath="/var/mockdata/worktree1"
dotnet run --project Cesivi.Server
Docker:
docker run -e CESIVI__DataRootPath=/app/data -v /host/path:/app/data cesivi
Pros: - No file modification required - Per-working-tree configuration - Supports CI/CD pipelines - Easy to script
Cons: - Environment-specific - Not visible in IDE
Method 3: Command-Line Arguments¶
Syntax: --Cesivi:DataRootPath=<path>
# Windows
dotnet run --project Cesivi.Server --Cesivi:DataRootPath="C:\MockData\Test"
# Linux/macOS
dotnet run --project Cesivi.Server --Cesivi:DataRootPath="/var/mockdata/test"
# With other arguments
dotnet run --project Cesivi.Server \
--Cesivi:HttpPort=5010 \
--Cesivi:DataRootPath="../MockData_Port5010"
Pros: - No file modification - Explicit and visible - Good for testing
Cons: - Must be specified every time - Long command lines
Method 4: .env File (Recommended for Test Scripts)¶
File: test-scripts/.env
The test scripts use a .env file for configuration, which is loaded by Load-TestEnv.ps1.
Setup:
# Copy template
cd test-scripts
Copy-Item .env.template .env
# Edit .env
notepad .env
Example .env:
# Server Ports
CESIVI_HTTP_PORT=5010
CESIVI_HTTPS_PORT=5011
# MockData Path (optional - if not set, uses appsettings.json default)
CESIVI_DATA_PATH=C:\MockData\WorkTree1
Usage in Test Scripts:
# Load environment
. "$PSScriptRoot\Load-TestEnv.ps1"
# Start server with env vars
$env:CESIVI__DataRootPath = $env:CESIVI_DATA_PATH
dotnet run --project Cesivi.Server
Pros: - Per-working-tree configuration - Not committed to git (.gitignore) - Easy to manage - Works with test automation
Cons: - Requires additional setup - Only works with test scripts
Multi-Working-Tree Setup¶
Scenario¶
You have multiple git worktrees running simultaneously on different ports, and you want each to use its own MockData folder.
Solution¶
Working Tree 1 (main - Port 5000):
# test-scripts/.env
CESIVI_HTTP_PORT=5000
CESIVI_DATA_PATH=C:\MockData\Main
Working Tree 2 (feature-branch - Port 5010):
# test-scripts/.env
CESIVI_HTTP_PORT=5010
CESIVI_DATA_PATH=C:\MockData\Feature
Working Tree 3 (bugfix - Port 5020):
# test-scripts/.env
CESIVI_HTTP_PORT=5020
CESIVI_DATA_PATH=C:\MockData\Bugfix
Start servers:
# Terminal 1 (main worktree)
cd C:\Source\_AI\Cesivi-main
$env:CESIVI__DataRootPath = "C:\MockData\Main"
$env:CESIVI_HTTP_PORT = 5000
dotnet run --project Cesivi.Server
# Terminal 2 (feature worktree)
cd C:\Source\_AI\Cesivi-feature
$env:CESIVI__DataRootPath = "C:\MockData\Feature"
$env:CESIVI_HTTP_PORT = 5010
dotnet run --project Cesivi.Server
# Terminal 3 (bugfix worktree)
cd C:\Source\_AI\Cesivi-bugfix
$env:CESIVI__DataRootPath = "C:\MockData\Bugfix"
$env:CESIVI_HTTP_PORT = 5020
dotnet run --project Cesivi.Server
Benefits: - ✅ Isolated data per worktree - ✅ No data conflicts - ✅ Independent testing - ✅ Can run simultaneously
Configuration Priority (Order of Precedence)¶
ASP.NET Core applies configuration in this order (last wins):
- appsettings.json (lowest priority)
- appsettings.{Environment}.json (e.g., appsettings.Development.json)
- Environment Variables
- Command-Line Arguments (highest priority)
Example¶
// appsettings.json
{
"Cesivi": {
"DataRootPath": "../MockData" // Priority 1
}
}
# Environment variable (overrides appsettings.json)
export CESIVI__DataRootPath="/var/mockdata/env" # Priority 3
# Command-line (overrides everything)
dotnet run --Cesivi:DataRootPath="/var/mockdata/cli" # Priority 4 (WINS)
Result: Server uses /var/mockdata/cli
Docker Configuration¶
docker-compose.yml Example¶
version: '3.8'
services:
cesivi:
image: cesivi:latest
environment:
- CESIVI__DataRootPath=/app/data
- CESIVI__HttpPort=5000
volumes:
- ./MockData:/app/data
ports:
- "5000:5000"
Docker Run Example¶
docker run -d \
-e CESIVI__DataRootPath=/app/data \
-v /host/mockdata:/app/data \
-p 5000:5000 \
cesivi:latest
Volume Mapping¶
Host Path: /host/mockdata
Container Path: /app/data
Environment Variable: CESIVI__DataRootPath=/app/data
This allows MockData to persist on the host filesystem.
Common Scenarios¶
Scenario 1: Development on Windows (Single Instance)¶
Goal: Use default MockData folder for simple development.
Solution: No configuration needed!
cd Cesivi.Server
dotnet run
# Uses default: ../MockData
Scenario 2: Testing with Custom Path¶
Goal: Use custom path for testing without modifying appsettings.json.
Solution: Use command-line argument.
dotnet run --project Cesivi.Server --Cesivi:DataRootPath="C:\Temp\TestData"
Scenario 3: CI/CD Pipeline¶
Goal: Use pipeline-specific MockData path.
Solution: Set environment variable in CI/CD configuration.
Azure DevOps Pipeline:
- task: PowerShell@2
displayName: 'Start Cesivi Server'
inputs:
targetType: 'inline'
script: |
$env:CESIVI__DataRootPath = "$(Build.ArtifactStagingDirectory)\MockData"
dotnet run --project Cesivi.Server
GitHub Actions:
- name: Start Cesivi Server
run: |
export CESIVI__DataRootPath="${{ runner.temp }}/MockData"
dotnet run --project Cesivi.Server
Scenario 4: Shared MockData Across Multiple Worktrees¶
Goal: Multiple worktrees (different ports) share the same MockData.
Solution: Point all worktrees to same path.
Worktree 1:
$env:CESIVI_HTTP_PORT = 5000
$env:CESIVI__DataRootPath = "C:\SharedMockData"
dotnet run --project Cesivi.Server
Worktree 2:
$env:CESIVI_HTTP_PORT = 5010
$env:CESIVI__DataRootPath = "C:\SharedMockData" # Same path!
dotnet run --project Cesivi.Server
⚠️ Warning: Only do this if you understand the implications. Both servers will read/write the same data files, which could cause conflicts if you modify data simultaneously.
Scenario 5: Network Share / UNC Path¶
Goal: Store MockData on network share for team collaboration.
Solution: Use UNC path in environment variable.
$env:CESIVI__DataRootPath = "\\server\share\TeamMockData"
dotnet run --project Cesivi.Server
Requirements: - Network share must be accessible - Appropriate permissions (read/write) - Consider performance (network I/O slower than local disk)
Verification¶
Check Current Configuration¶
The server exposes configuration through the health endpoint:
# Get health info including MockData path
curl http://localhost:5000/_vti_bin/health/info
# Response (example):
{
"status": "Healthy",
"mockDataPath": "C:\\Source\\_AI\\Cesivi2\\MockData",
"filesystemHealthy": true,
"serverVersion": "1.0.0",
...
}
PowerShell Check¶
# Check health endpoint
$health = Invoke-RestMethod -Uri "http://localhost:5000/_vti_bin/health/info"
Write-Host "MockData Path: $($health.mockDataPath)"
Write-Host "Filesystem Healthy: $($health.filesystemHealthy)"
Troubleshooting¶
Problem: Server can't find MockData folder¶
Symptoms: - Error: "MockData directory not found" - 500 errors on API calls
Solution:
1. Check path exists: Test-Path "C:\Your\Path\MockData"
2. Verify permissions (read/write)
3. Check configuration:
curl http://localhost:5000/_vti_bin/health/info | jq .mockDataPath
Problem: Wrong MockData folder being used¶
Symptoms: - Server uses default path despite setting environment variable - Data not persisting where expected
Solution:
1. Check configuration precedence (command-line > env var > appsettings.json)
2. Verify environment variable name: CESIVI__DataRootPath (double underscore!)
3. Check health endpoint to see actual path used
Problem: Permission denied errors¶
Symptoms: - Error: "Access to path 'C:\MockData...' is denied" - File write failures
Solution:
1. Verify folder permissions
2. Run server with appropriate privileges
3. Check antivirus/security software blocking access
4. Use User Profile folder: $env:USERPROFILE\MockData
Problem: Path with spaces not working¶
Symptoms: - Path truncated at first space - Folder not found
Solution: Use quotes in environment variable:
$env:CESIVI__DataRootPath = "C:\Mock Data\Test" # Correct
# Not: C:\Mock Data\Test (without quotes)
Best Practices¶
1. Use Environment Variables for Multi-Working-Tree¶
✅ DO: Set CESIVI__DataRootPath per worktree via .env file
❌ DON'T: Modify appsettings.json per worktree
2. Use Absolute Paths in Production¶
✅ DO: Use absolute paths like C:\MockData\Production
⚠️ CAUTION: Relative paths like ../MockData depend on working directory
3. Separate Data Per Environment¶
✅ DO: Use different paths for dev/test/staging ❌ DON'T: Share MockData between incompatible environments
4. Version Control¶
✅ DO: Keep .env in .gitignore
✅ DO: Commit .env.template with examples
❌ DON'T: Commit absolute paths in appsettings.json
5. Docker Volumes¶
✅ DO: Mount volumes for persistence ✅ DO: Use named volumes for production containers ❌ DON'T: Store data inside container without volume
Related Configuration¶
Ports¶
See _docs/MULTI_WORKING_TREE.md for port configuration.
Environment Variables:
- CESIVI_HTTP_PORT - HTTP port (default: 5000)
- CESIVI_HTTPS_PORT - HTTPS port (default: 5001)
Logging¶
Logs are stored in {DataRootPath}/Logs/Server by default.
Override via:
{
"Cesivi": {
"LogPath": "C:\\CustomLogs\\Server"
}
}
Or:
export CESIVI__LogPath="/var/log/cesivi"
Summary Table¶
| Method | Priority | Use Case | Persistent | Multi-Worktree |
|---|---|---|---|---|
| appsettings.json | Low | Single instance | Yes | No |
| Environment Variable | High | Multi-worktree, CI/CD | No | Yes |
| Command-Line | Highest | Testing, one-off runs | No | Yes |
| .env File | N/A* | Test scripts | No | Yes |
| Docker Volume | N/A* | Containerized | Yes | N/A |
*Applied via environment variable internally
Examples¶
Example 1: Quick Test with Temporary Data¶
dotnet run --project Cesivi.Server --Cesivi:DataRootPath="C:\Temp\QuickTest"
Example 2: Production Setup¶
// appsettings.Production.json
{
"Cesivi": {
"DataRootPath": "/var/cesivi/data",
"LogPath": "/var/log/cesivi"
}
}
Example 3: Multi-Worktree Script¶
# start-worktree.ps1
param([string]$WorkTree, [int]$Port)
$dataPath = "C:\MockData\$WorkTree"
New-Item -ItemType Directory -Force -Path $dataPath
$env:CESIVI_HTTP_PORT = $Port
$env:CESIVI__DataRootPath = $dataPath
Write-Host "Starting worktree '$WorkTree' on port $Port with data path: $dataPath"
dotnet run --project Cesivi.Server
Usage:
.\start-worktree.ps1 -WorkTree "main" -Port 5000
.\start-worktree.ps1 -WorkTree "feature-x" -Port 5010
See Also¶
appsettings.json- Server configuration filetest-scripts/.env.template- Test environment templatetest-scripts/Load-TestEnv.ps1- Environment loader script_docs/MULTI_WORKING_TREE.md- Multi-working-tree setup guide_docs/DOCKER.md- Docker deployment guide- ASP.NET Core Configuration: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/