CLI Reference
CLI Reference
Section titled “CLI Reference”Complete reference documentation for all MirthSync commands and options. MirthSync is a command-line tool for synchronizing Mirth Connect and Open Integration Engine (OIE) code between servers with built-in Git integration.
Overview
Section titled “Overview”MirthSync has 3 core actions:
| Action | Description |
|---|---|
pull | Download channels, code templates, and configurations from server to local files |
push | Upload local files to server |
git <subcommand> | Perform git operations (init, status, add, commit, diff, log, branch, checkout, remote, pull, push, reset) |
Basic Syntax:
./mirthsync.sh [options] action./mirthsync.sh [options] actionmirthsync.bat [options] actionGlobal Options
Section titled “Global Options”These options apply to all MirthSync commands:
Server Connection
Section titled “Server Connection”| Option | Description |
|---|---|
-s, --server SERVER_URL | Full HTTP(s) URL of the Mirth Connect server (required for pull/push) |
-u, --username USERNAME | Username for authentication (required for pull/push) |
-p, --password PASSWORD | Password for authentication (can use MIRTHSYNC_PASSWORD env var) |
-i, --ignore-cert-warnings | Ignore SSL certificate warnings |
Operation Control
Section titled “Operation Control”| Option | Description |
|---|---|
-t, --target TARGET_DIR | Base directory for file operations (required) |
-f, --force | Overwrite existing files during pull/push without regard for revisions |
-v | Increase verbosity level (can specify multiple times: -vvv) |
-I, --interactive | Allow console prompts for user input |
Disk Mode
Section titled “Disk Mode”| Option | Values | Description |
|---|---|---|
-m, --disk-mode MODE | code (default) | Most granular - extracts JavaScript, SQL to separate files |
items | Individual XML files for channels and code templates | |
groups | Channel groups and code template library level | |
backup | Full backup XML file (equivalent to Mirth Administrator backup) |
Selective Sync
Section titled “Selective Sync”| Option | Description |
|---|---|
-r, --restrict-to-path PATH | Limit scope to specific path within target directory |
--include-configuration-map | Include configuration map in pull/push (default: false) |
--skip-disabled | Skip disabled channels (default: false, requires Mirth 3.9+) |
Channel Deployment
Section titled “Channel Deployment”| Option | Description |
|---|---|
-d, --deploy | Deploy each channel immediately after saving (individual deployment) |
--deploy-all | Recommended: Deploy all channels in bulk after push (much faster for multiple channels) |
Git Integration
Section titled “Git Integration”| Option | Description |
|---|---|
--git-init | Initialize git repository in target directory if not present |
--auto-commit | Automatically commit changes after pull/push operations |
--commit-message MESSAGE | Commit message for git operations (default: “mirthsync commit”) |
--git-author NAME | Git author name for commits |
--git-email EMAIL | Git author email for commits |
Orphaned File Management
Section titled “Orphaned File Management”| Option | Description |
|---|---|
--delete-orphaned | Delete orphaned local files during pull operations |
| Option | Description |
|---|---|
-h, --help | Show help information |
Commands
Section titled “Commands”pull - Download from Server
Section titled “pull - Download from Server”Pull (download) channels, code templates, configurations, and global scripts from your Mirth Connect or Open Integration Engine server and save them as local files.
Syntax:
./mirthsync.sh -s SERVER_URL -u USERNAME -p PASSWORD -t TARGET_DIR pull [options]./mirthsync.sh -s SERVER_URL -u USERNAME -p PASSWORD -t TARGET_DIR pull [options]mirthsync.bat -s SERVER_URL -u USERNAME -p PASSWORD -t TARGET_DIR pull [options]Required Options:
-s, --server- Server API URL-u, --username- Username-p, --password- Password (or setMIRTHSYNC_PASSWORDenv var)-t, --target- Target directory
Common Options:
-f, --force- Overwrite local files without prompting-i, --ignore-cert-warnings- Ignore SSL certificate warnings-r, --restrict-to-path PATH- Pull only specific path--include-configuration-map- Include configuration map--skip-disabled- Skip disabled channels--delete-orphaned- Delete orphaned local files--auto-commit- Automatically commit changes after pull--git-init- Initialize git repo if needed
Examples:
# Basic pull./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# Pull with force (overwrite local changes)./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -f -t ./mirth-config pull
# Pull and handle orphaned files./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --delete-orphaned -t ./mirth-config pull
# Pull with interactive orphan file deletion./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --delete-orphaned --interactive -t ./mirth-config pull
# Pull and auto-commit to git./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --git-init --auto-commit --commit-message "Pull from production" -t ./mirth-config pull
# Pull only configuration map./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --include-configuration-map -t ./mirth-config pull
# Pull only specific channel group./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -r "Channels/Production Group" -t ./mirth-config pull# Basic pull./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# Pull with force (overwrite local changes)./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -f -t ./mirth-config pull
# Pull and handle orphaned files./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --delete-orphaned -t ./mirth-config pull
# Pull with interactive orphan file deletion./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --delete-orphaned --interactive -t ./mirth-config pull
# Pull and auto-commit to git./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --git-init --auto-commit --commit-message "Pull from production" -t ./mirth-config pull
# Pull only configuration map./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --include-configuration-map -t ./mirth-config pull
# Pull only specific channel group./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -r "Channels/Production Group" -t ./mirth-config pull# Basic pullmirthsync.bat -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# Pull with force (overwrite local changes)mirthsync.bat -s https://localhost:8443/api -u admin -p admin -f -t ./mirth-config pull
# Pull and handle orphaned filesmirthsync.bat -s https://localhost:8443/api -u admin -p admin --delete-orphaned -t ./mirth-config pull
# Pull with interactive orphan file deletionmirthsync.bat -s https://localhost:8443/api -u admin -p admin --delete-orphaned --interactive -t ./mirth-config pull
# Pull and auto-commit to gitmirthsync.bat -s https://localhost:8443/api -u admin -p admin --git-init --auto-commit --commit-message "Pull from production" -t ./mirth-config pull
# Pull only configuration mapmirthsync.bat -s https://localhost:8443/api -u admin -p admin --include-configuration-map -t ./mirth-config pull
# Pull only specific channel groupmirthsync.bat -s https://localhost:8443/api -u admin -p admin -r "Channels/Production Group" -t ./mirth-config pullWhat Gets Pulled:
- Channels (with JavaScript extracted to separate files in default
codemode) - Code Templates
- Configuration Map (if
--include-configuration-mapspecified) - Global Scripts
- Channel Groups
- Resources
- Alerts
Output Example:
Connecting to Mirth Connect...✓ Connected to https://localhost:8443✓ Pulled 15 channels✓ Pulled 8 code templates✓ Pulled configuration map✓ Files saved to ./mirth-config/push - Upload to Server
Section titled “push - Upload to Server”Push (upload) your local channels, code templates, configurations, and global scripts to a Mirth Connect or Open Integration Engine server.
Syntax:
./mirthsync.sh -s SERVER_URL -u USERNAME -p PASSWORD -t TARGET_DIR push [options]./mirthsync.sh -s SERVER_URL -u USERNAME -p PASSWORD -t TARGET_DIR push [options]mirthsync.bat -s SERVER_URL -u USERNAME -p PASSWORD -t TARGET_DIR push [options]Required Options:
-s, --server- Server API URL-u, --username- Username-p, --password- Password (or setMIRTHSYNC_PASSWORDenv var)-t, --target- Target directory
Common Options:
-f, --force- Force push without regard for revisions-i, --ignore-cert-warnings- Ignore SSL certificate warnings-r, --restrict-to-path PATH- Push only specific path--include-configuration-map- Include configuration map--skip-disabled- Skip disabled channels-d, --deploy- Deploy each channel immediately after saving--deploy-all- Recommended: Deploy all channels in bulk (faster)--auto-commit- Automatically commit changes after push
Examples:
# Basic push./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config push
# Push with force./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -f -t ./mirth-config push
# Push and deploy channels individually./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --deploy -t ./mirth-config push
# Push and deploy all channels in bulk (RECOMMENDED for multiple channels)./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --deploy-all -t ./mirth-config push
# Push only specific channel group./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -r "Channels/Production Group" -t ./mirth-config push
# Push with configuration map./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --include-configuration-map -f -t ./mirth-config push
# Push and bulk deploy specific group./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --deploy-all -r "Channels/Production Group" -t ./mirth-config push# Basic push./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config push
# Push with force./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -f -t ./mirth-config push
# Push and deploy channels individually./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --deploy -t ./mirth-config push
# Push and deploy all channels in bulk (RECOMMENDED for multiple channels)./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --deploy-all -t ./mirth-config push
# Push only specific channel group./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -r "Channels/Production Group" -t ./mirth-config push
# Push with configuration map./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --include-configuration-map -f -t ./mirth-config push
# Push and bulk deploy specific group./mirthsync.sh -s https://localhost:8443/api -u admin -p admin --deploy-all -r "Channels/Production Group" -t ./mirth-config push# Basic pushmirthsync.bat -s https://localhost:8443/api -u admin -p admin -t ./mirth-config push
# Push with forcemirthsync.bat -s https://localhost:8443/api -u admin -p admin -f -t ./mirth-config push
# Push and deploy channels individuallymirthsync.bat -s https://localhost:8443/api -u admin -p admin --deploy -t ./mirth-config push
# Push and deploy all channels in bulk (RECOMMENDED for multiple channels)mirthsync.bat -s https://localhost:8443/api -u admin -p admin --deploy-all -t ./mirth-config push
# Push only specific channel groupmirthsync.bat -s https://localhost:8443/api -u admin -p admin -r "Channels/Production Group" -t ./mirth-config push
# Push with configuration mapmirthsync.bat -s https://localhost:8443/api -u admin -p admin --include-configuration-map -f -t ./mirth-config push
# Push and bulk deploy specific groupmirthsync.bat -s https://localhost:8443/api -u admin -p admin --deploy-all -r "Channels/Production Group" -t ./mirth-config pushDeployment Options:
| Option | Behavior | Performance | Use Case |
|---|---|---|---|
| No deployment flag | Saves channels but doesn’t deploy them | N/A | When you want to deploy manually later |
--deploy | Deploys each channel immediately after saving | N API calls for N channels | Single channel or when order is critical |
--deploy-all | Collects all channels, then deploys in one bulk operation | 1 API call for all channels | Recommended for multiple channels |
Benefits of --deploy-all:
- Significantly faster when pushing multiple channels
- Allows Mirth’s dependency logic to control deployment order
- Reduces API calls and server load
- Recommended for production deployments
git - Version Control Operations
Section titled “git - Version Control Operations”MirthSync includes comprehensive built-in Git integration for version control of your Mirth Connect configurations. All git operations work directly with your target directory without requiring server credentials.
Syntax:
./mirthsync.sh -t TARGET_DIR git <subcommand> [arguments]./mirthsync.sh -t TARGET_DIR git <subcommand> [arguments]mirthsync.bat -t TARGET_DIR git <subcommand> [arguments]Required Option:
-t, --target- Target directory (must contain or will contain git repository)
Git Subcommands
Section titled “Git Subcommands”git init - Initialize Repository
Section titled “git init - Initialize Repository”Create a new git repository in the target directory.
./mirthsync.sh -t ./mirth-config git init./mirthsync.sh -t ./mirth-config git initmirthsync.bat -t ./mirth-config git initgit status - Check Status
Section titled “git status - Check Status”Display the current state of the working directory and staging area.
./mirthsync.sh -t ./mirth-config git status./mirthsync.sh -t ./mirth-config git statusmirthsync.bat -t ./mirth-config git statusOutput shows:
- Modified files
- Staged changes
- Untracked files
- Current branch
git add - Stage Changes
Section titled “git add - Stage Changes”Stage all changes in the working directory for commit.
./mirthsync.sh -t ./mirth-config git add./mirthsync.sh -t ./mirth-config git addmirthsync.bat -t ./mirth-config git addgit commit - Commit Changes
Section titled “git commit - Commit Changes”Commit staged changes to the repository.
# Basic commit (requires --commit-message)./mirthsync.sh -t ./mirth-config --commit-message "Updated channel configurations" git commit
# Commit with custom author./mirthsync.sh -t ./mirth-config --commit-message "Updated channels" --git-author "John Doe" --git-email "john@example.com" git commit# Basic commit (requires --commit-message)./mirthsync.sh -t ./mirth-config --commit-message "Updated channel configurations" git commit
# Commit with custom author./mirthsync.sh -t ./mirth-config --commit-message "Updated channels" --git-author "John Doe" --git-email "john@example.com" git commit# Basic commit (requires --commit-message)mirthsync.bat -t ./mirth-config --commit-message "Updated channel configurations" git commit
# Commit with custom authormirthsync.bat -t ./mirth-config --commit-message "Updated channels" --git-author "John Doe" --git-email "john@example.com" git commitRequired Options:
--commit-message MESSAGE- Commit message
Optional:
--git-author NAME- Author name (defaults to git config)--git-email EMAIL- Author email (defaults to git config)
git diff - Show Differences
Section titled “git diff - Show Differences”Display differences between working directory, index, and commits.
# Show unstaged changes (working directory vs index)./mirthsync.sh -t ./mirth-config git diff
# Show staged changes (index vs HEAD)./mirthsync.sh -t ./mirth-config git diff --staged./mirthsync.sh -t ./mirth-config git diff --cached # Same as --staged
# Compare commits/branches./mirthsync.sh -t ./mirth-config git diff HEAD~1..HEAD./mirthsync.sh -t ./mirth-config git diff main..feature-branch./mirthsync.sh -t ./mirth-config git diff abc123..def456# Show unstaged changes (working directory vs index)./mirthsync.sh -t ./mirth-config git diff
# Show staged changes (index vs HEAD)./mirthsync.sh -t ./mirth-config git diff --staged./mirthsync.sh -t ./mirth-config git diff --cached # Same as --staged
# Compare commits/branches./mirthsync.sh -t ./mirth-config git diff HEAD~1..HEAD./mirthsync.sh -t ./mirth-config git diff main..feature-branch./mirthsync.sh -t ./mirth-config git diff abc123..def456# Show unstaged changes (working directory vs index)mirthsync.bat -t ./mirth-config git diff
# Show staged changes (index vs HEAD)mirthsync.bat -t ./mirth-config git diff --stagedmirthsync.bat -t ./mirth-config git diff --cached # Same as --staged
# Compare commits/branchesmirthsync.bat -t ./mirth-config git diff HEAD~1..HEADmirthsync.bat -t ./mirth-config git diff main..feature-branchmirthsync.bat -t ./mirth-config git diff abc123..def456Diff Options:
- No options - Show unstaged changes
--stagedor--cached- Show staged changes<revision-spec>- Compare specific commits/branches (e.g.,HEAD~1..HEAD)
git log - View History
Section titled “git log - View History”Display commit history.
# Show all commits./mirthsync.sh -t ./mirth-config git log
# Show last N commits./mirthsync.sh -t ./mirth-config git log 5./mirthsync.sh -t ./mirth-config git log 10# Show all commits./mirthsync.sh -t ./mirth-config git log
# Show last N commits./mirthsync.sh -t ./mirth-config git log 5./mirthsync.sh -t ./mirth-config git log 10# Show all commitsmirthsync.bat -t ./mirth-config git log
# Show last N commitsmirthsync.bat -t ./mirth-config git log 5mirthsync.bat -t ./mirth-config git log 10git branch - List Branches
Section titled “git branch - List Branches”Display all branches in the repository.
./mirthsync.sh -t ./mirth-config git branch./mirthsync.sh -t ./mirth-config git branchmirthsync.bat -t ./mirth-config git branchgit checkout - Switch Branches
Section titled “git checkout - Switch Branches”Switch to an existing branch.
# Switch to existing branch./mirthsync.sh -t ./mirth-config git checkout develop./mirthsync.sh -t ./mirth-config git checkout main# Switch to existing branch./mirthsync.sh -t ./mirth-config git checkout develop./mirthsync.sh -t ./mirth-config git checkout main# Switch to existing branchmirthsync.bat -t ./mirth-config git checkout developmirthsync.bat -t ./mirth-config git checkout maingit remote - List Remotes
Section titled “git remote - List Remotes”Display configured remote repositories.
./mirthsync.sh -t ./mirth-config git remote./mirthsync.sh -t ./mirth-config git remotemirthsync.bat -t ./mirth-config git remotegit pull - Pull from Remote
Section titled “git pull - Pull from Remote”Fetch and merge changes from remote repository.
./mirthsync.sh -t ./mirth-config git pull./mirthsync.sh -t ./mirth-config git pullmirthsync.bat -t ./mirth-config git pullgit push - Push to Remote
Section titled “git push - Push to Remote”Push committed changes to remote repository.
./mirthsync.sh -t ./mirth-config git push./mirthsync.sh -t ./mirth-config git pushmirthsync.bat -t ./mirth-config git pushgit reset - Reset Changes
Section titled “git reset - Reset Changes”Reset the repository to a specific state.
# Reset staged changes (mixed mode - default)./mirthsync.sh -t ./mirth-config git reset
# Soft reset - move HEAD, keep index and working directory# Use full commit hash from git log./mirthsync.sh -t ./mirth-config git reset --soft abc123def456
# Mixed reset - move HEAD and index, keep working directory./mirthsync.sh -t ./mirth-config git reset --mixed abc123def456
# Hard reset - reset HEAD, index, and working directory./mirthsync.sh -t ./mirth-config git reset --hard abc123def456# Reset staged changes (mixed mode - default)./mirthsync.sh -t ./mirth-config git reset
# Soft reset - move HEAD, keep index and working directory# Use full commit hash from git log./mirthsync.sh -t ./mirth-config git reset --soft abc123def456
# Mixed reset - move HEAD and index, keep working directory./mirthsync.sh -t ./mirth-config git reset --mixed abc123def456
# Hard reset - reset HEAD, index, and working directory./mirthsync.sh -t ./mirth-config git reset --hard abc123def456# Reset staged changes (mixed mode - default)mirthsync.bat -t ./mirth-config git reset
# Soft reset - move HEAD, keep index and working directory# Use full commit hash from git logmirthsync.bat -t ./mirth-config git reset --soft abc123def456
# Mixed reset - move HEAD and index, keep working directorymirthsync.bat -t ./mirth-config git reset --mixed abc123def456
# Hard reset - reset HEAD, index, and working directorymirthsync.bat -t ./mirth-config git reset --hard abc123def456Reset Modes:
--soft- Move HEAD only, keep index and working directory unchanged--mixed- Move HEAD and reset index, keep working directory (default)--hard- Reset HEAD, index, and working directory (⚠️ destroys changes)
Complete Git Workflow Example
Section titled “Complete Git Workflow Example”# 1. Pull latest from Mirth server./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# 2. Check git status./mirthsync.sh -t ./mirth-config git status
# 3. View unstaged differences./mirthsync.sh -t ./mirth-config git diff
# 4. Stage changes./mirthsync.sh -t ./mirth-config git add
# 5. Review staged changes./mirthsync.sh -t ./mirth-config git diff --staged
# 6. Commit with message./mirthsync.sh -t ./mirth-config --commit-message "Updated from production server" git commit
# 7. View commit history./mirthsync.sh -t ./mirth-config git log 5
# 8. Push to remote./mirthsync.sh -t ./mirth-config git push# 1. Pull latest from Mirth server./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# 2. Check git status./mirthsync.sh -t ./mirth-config git status
# 3. View unstaged differences./mirthsync.sh -t ./mirth-config git diff
# 4. Stage changes./mirthsync.sh -t ./mirth-config git add
# 5. Review staged changes./mirthsync.sh -t ./mirth-config git diff --staged
# 6. Commit with message./mirthsync.sh -t ./mirth-config --commit-message "Updated from production server" git commit
# 7. View commit history./mirthsync.sh -t ./mirth-config git log 5
# 8. Push to remote./mirthsync.sh -t ./mirth-config git push# 1. Pull latest from Mirth servermirthsync.bat -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# 2. Check git statusmirthsync.bat -t ./mirth-config git status
# 3. View unstaged differencesmirthsync.bat -t ./mirth-config git diff
# 4. Stage changesmirthsync.bat -t ./mirth-config git add
# 5. Review staged changesmirthsync.bat -t ./mirth-config git diff --staged
# 6. Commit with messagemirthsync.bat -t ./mirth-config --commit-message "Updated from production server" git commit
# 7. View commit historymirthsync.bat -t ./mirth-config git log 5
# 8. Push to remotemirthsync.bat -t ./mirth-config git pushAuto-Commit Workflow
Section titled “Auto-Commit Workflow”MirthSync can automatically handle git operations:
# Pull and auto-commit in one command./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --auto-commit --commit-message "Pulled from production" pull
# Initialize git repo and auto-commit./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --git-init --auto-commit --commit-message "Initial pull" pull
# Auto-commit with custom author./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --auto-commit --commit-message "Sync from dev" --git-author "CI System" --git-email "ci@company.com" pull# Pull and auto-commit in one command./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --auto-commit --commit-message "Pulled from production" pull
# Initialize git repo and auto-commit./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --git-init --auto-commit --commit-message "Initial pull" pull
# Auto-commit with custom author./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --auto-commit --commit-message "Sync from dev" --git-author "CI System" --git-email "ci@company.com" pull# Pull and auto-commit in one commandmirthsync.bat -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --auto-commit --commit-message "Pulled from production" pull
# Initialize git repo and auto-commitmirthsync.bat -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --git-init --auto-commit --commit-message "Initial pull" pull
# Auto-commit with custom authormirthsync.bat -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --auto-commit --commit-message "Sync from dev" --git-author "CI System" --git-email "ci@company.com" pullEnvironment Variables
Section titled “Environment Variables”MirthSync respects these environment variables:
| Variable | Description | Example |
|---|---|---|
MIRTHSYNC_PASSWORD | Alternative to --password option | export MIRTHSYNC_PASSWORD=your_password |
Setting Environment Variables:
# In your shell profile (~/.bashrc, ~/.zshrc)export MIRTHSYNC_PASSWORD=your_password
# For current session onlyexport MIRTHSYNC_PASSWORD=your_password# PowerShell$env:MIRTHSYNC_PASSWORD="your_password"
# Command Promptset MIRTHSYNC_PASSWORD=your_passwordFile Structure
Section titled “File Structure”MirthSync creates an organized directory structure based on the --disk-mode setting:
code mode (default)
Section titled “code mode (default)”Most granular - JavaScript and SQL extracted to separate files:
mirth-config/├── Channels/│ ├── Default Group/│ │ └── ADT_Inbound/│ │ ├── channel.xml│ │ ├── sourceConnector.js│ │ ├── destinationConnector_1.js│ │ └── transformer.js│ └── Production Group/│ └── Lab_Results/│ └── ...├── CodeTemplates/│ ├── Utilities/│ │ ├── library.xml│ │ └── parseHL7.js│ └── ...├── GlobalScripts/│ └── ...└── Resources/ └── ...items mode
Section titled “items mode”Individual XML files for channels and code templates:
mirth-config/├── Channels/│ ├── Default Group/│ │ └── ADT_Inbound.xml│ └── Production Group/│ └── Lab_Results.xml└── CodeTemplates/ ├── Utilities.xml └── ...groups mode
Section titled “groups mode”Channel groups and code template libraries:
mirth-config/├── ChannelGroups/│ ├── Default Group.xml│ └── Production Group.xml└── CodeTemplateLibraries/ └── Utilities.xmlbackup mode
Section titled “backup mode”Full backup XML (equivalent to Mirth Administrator backup):
mirth-config/└── backup.xmlCommon Workflows
Section titled “Common Workflows”Daily Development Workflow
Section titled “Daily Development Workflow”# 1. Pull latest from server./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# 2. Work on channels in Admin Console or edit files directly
# 3. Pull changes to files./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# 4. Review changes with git./mirthsync.sh -t ./mirth-config git diff
# 5. Commit to git./mirthsync.sh -t ./mirth-config git add./mirthsync.sh -t ./mirth-config --commit-message "Updated ADT channel" git commit./mirthsync.sh -t ./mirth-config git push# 1. Pull latest from server./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# 2. Work on channels in Admin Console or edit files directly
# 3. Pull changes to files./mirthsync.sh -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# 4. Review changes with git./mirthsync.sh -t ./mirth-config git diff
# 5. Commit to git./mirthsync.sh -t ./mirth-config git add./mirthsync.sh -t ./mirth-config --commit-message "Updated ADT channel" git commit./mirthsync.sh -t ./mirth-config git push# 1. Pull latest from servermirthsync.bat -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# 2. Work on channels in Admin Console or edit files directly
# 3. Pull changes to filesmirthsync.bat -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# 4. Review changes with gitmirthsync.bat -t ./mirth-config git diff
# 5. Commit to gitmirthsync.bat -t ./mirth-config git addmirthsync.bat -t ./mirth-config --commit-message "Updated ADT channel" git commitmirthsync.bat -t ./mirth-config git pushDeployment to Production
Section titled “Deployment to Production”# 1. Ensure you're on the correct branchcd ./mirth-config && git checkout main && git pull && cd ..
# 2. Preview what would be pushed (manual verification)ls -la ./mirth-config/Channels/
# 3. Push to production./mirthsync.sh -s https://prod-server:8443/api -u admin -p $PROD_PASSWORD -f -t ./mirth-config push
# 4. Deploy all channels in bulk./mirthsync.sh -s https://prod-server:8443/api -u admin -p $PROD_PASSWORD --deploy-all -t ./mirth-config push
# 5. Verify (check server manually)# 1. Ensure you're on the correct branchcd ./mirth-config && git checkout main && git pull && cd ..
# 2. Preview what would be pushed (manual verification)ls -la ./mirth-config/Channels/
# 3. Push to production./mirthsync.sh -s https://prod-server:8443/api -u admin -p $PROD_PASSWORD -f -t ./mirth-config push
# 4. Deploy all channels in bulk./mirthsync.sh -s https://prod-server:8443/api -u admin -p $PROD_PASSWORD --deploy-all -t ./mirth-config push
# 5. Verify (check server manually)# 1. Ensure you're on the correct branchcd ./mirth-config; git checkout main; git pull; cd ..
# 2. Preview what would be pushed (manual verification)dir ./mirth-config/Channels/
# 3. Push to productionmirthsync.bat -s https://prod-server:8443/api -u admin -p %PROD_PASSWORD% -f -t ./mirth-config push
# 4. Deploy all channels in bulkmirthsync.bat -s https://prod-server:8443/api -u admin -p %PROD_PASSWORD% --deploy-all -t ./mirth-config push
# 5. Verify (check server manually)Emergency Rollback
Section titled “Emergency Rollback”# 1. Find the commit to rollback to./mirthsync.sh -t ./mirth-config git log 10
# 2. Reset to previous commit (hard reset)./mirthsync.sh -t ./mirth-config git reset --hard abc1234
# 3. Push reverted configuration to server./mirthsync.sh -s https://prod-server:8443/api -u admin -p $PROD_PASSWORD -f -t ./mirth-config push# 1. Find the commit to rollback to./mirthsync.sh -t ./mirth-config git log 10
# 2. Reset to previous commit (hard reset)./mirthsync.sh -t ./mirth-config git reset --hard abc1234
# 3. Push reverted configuration to server./mirthsync.sh -s https://prod-server:8443/api -u admin -p $PROD_PASSWORD -f -t ./mirth-config push# 1. Find the commit to rollback tomirthsync.bat -t ./mirth-config git log 10
# 2. Reset to previous commit (hard reset)mirthsync.bat -t ./mirth-config git reset --hard abc1234
# 3. Push reverted configuration to servermirthsync.bat -s https://prod-server:8443/api -u admin -p %PROD_PASSWORD% -f -t ./mirth-config pushCI/CD Integration
Section titled “CI/CD Integration”# In GitHub Actions or Jenkins pipeline
# Pull from dev server./mirthsync.sh -s ${DEV_URL} -u ${DEV_USER} -p ${DEV_PASS} -i -t src pull
# Commit changes./mirthsync.sh -t src git add./mirthsync.sh -t src --commit-message "Automated pull from dev" git commit./mirthsync.sh -t src git push
# On merge to main, deploy to staging./mirthsync.sh -s ${STAGE_URL} -u ${STAGE_USER} -p ${STAGE_PASS} -t src --include-configuration-map -f push# In GitHub Actions or Jenkins pipeline
# Pull from dev server./mirthsync.sh -s ${DEV_URL} -u ${DEV_USER} -p ${DEV_PASS} -i -t src pull
# Commit changes./mirthsync.sh -t src git add./mirthsync.sh -t src --commit-message "Automated pull from dev" git commit./mirthsync.sh -t src git push
# On merge to main, deploy to staging./mirthsync.sh -s ${STAGE_URL} -u ${STAGE_USER} -p ${STAGE_PASS} -t src --include-configuration-map -f push# In GitHub Actions or Jenkins pipeline
# Pull from dev servermirthsync.bat -s ${env:DEV_URL} -u ${env:DEV_USER} -p ${env:DEV_PASS} -i -t src pull
# Commit changesmirthsync.bat -t src git addmirthsync.bat -t src --commit-message "Automated pull from dev" git commitmirthsync.bat -t src git push
# On merge to main, deploy to stagingmirthsync.bat -s ${env:STAGE_URL} -u ${env:STAGE_USER} -p ${env:STAGE_PASS} -t src --include-configuration-map -f push