Skip to content

Configuration System Overview

MANYOYO provides a flexible configuration system to simplify command-line operations and manage complex runtime environments.

Configuration Methods

MANYOYO supports two main configuration methods:

  1. Environment Variables: Pass environment variables like BASE_URL and TOKEN to CLI tools inside the container
  2. Configuration Files: Manage MANYOYO runtime parameters using JSON5 format configuration files

JSON5 Format Explanation

Configuration files use JSON5 format, which has the following advantages over standard JSON:

  • Support for Comments: You can use // for single-line comments and /* */ for multi-line comments
  • Trailing Commas: Arrays and objects can have a comma after the last item
  • More Flexible Key Names: Object keys can be unquoted (when they follow identifier rules)
  • Better Readability: Suitable for manual editing and maintenance

Example:

json5
{
    // This is a comment
    containerName: "my-dev",  // Keys can be unquoted
    imageVersion: "1.8.0-common",  // Trailing commas are supported
}

Configuration File Path Rules

Run Configuration

  • manyoyo run -r claude → Loads runs.claude from ~/.manyoyo/manyoyo.json
  • manyoyo run -r <name> only accepts runs.<name> names, not file paths

Global Configuration

  • When running any manyoyo command, ~/.manyoyo/manyoyo.json is automatically loaded (if it exists)

Environment Files

  • manyoyo run --ef /abs/path/myenv.env → Loads environment file from absolute path
  • --ef only accepts absolute paths (no short name / relative path)

Priority Mechanism

MANYOYO configuration parameters are divided into two categories with different merging behaviors:

Override Parameters

These parameters only take the value from the highest priority:

Priority Order: Command-line arguments > runs.<name> > Global configuration > Default values

Override parameters include:

  • containerName - Container name
  • hostPath - Host working directory
  • containerPath - Container working directory
  • imageName - Image name
  • imageVersion - Image version
  • containerMode - Container nesting mode
  • yolo - YOLO mode selection
  • shellPrefix - Command prefix
  • shell - Execution command
  • serverUser - Web login username
  • serverPass - Web login password

For web auth parameters serverUser / serverPass, environment variables are also supported with this priority:

command-line arguments > runs.<name> > global configuration > environment variables > defaults

Environment variable keys: MANYOYO_SERVER_USER, MANYOYO_SERVER_PASS.

Example:

bash
# Global configuration sets imageVersion: "1.8.0-common"
# Run configuration sets imageVersion: "1.8.0-full"
# Final value is "1.8.0-full" (run configuration has higher priority)

Merge Parameters

These parameters are accumulated and merged in order:

Merge Order: Global configuration + runs.<name> + Command-line arguments

Merge parameters include:

  • env - Environment variable map (merged by key)
  • envFile - Environment file array
  • volumes - Mount volume array
  • ports - Port mapping array
  • imageBuildArgs - Image build argument array

Example:

bash
# Global configuration: env: {"VAR1":"value1"}
# runs.demo: env: {"VAR2":"value2"}
# Command line: -e "VAR3=value3"
# Final result: VAR1/VAR2/VAR3 are effective; same key is overridden by later source

Configuration Merge Rules Table

Parameter TypeParameter NameMerge BehaviorExample
OverridecontainerNameTakes highest priority valueCLI -n test overrides runs.<name> or global value
OverridehostPathTakes highest priority valueDefaults to current directory
OverridecontainerPathTakes highest priority valueDefaults to same as hostPath
OverrideimageNameTakes highest priority valueDefault localhost/xcanwin/manyoyo
OverrideimageVersionTakes highest priority valuee.g., 1.8.0-common
OverridecontainerModeTakes highest priority valuecommon, dind, sock
OverrideyoloTakes highest priority valuec, gm, cx, oc
OverrideserverUserUses web auth priority orderCLI > runs.<name> > global > env vars > defaults
OverrideserverPassUses web auth priority orderCLI > runs.<name> > global > env vars > defaults
MergeenvMap merge by keyGlobal + runs.<name> + CLI (later source overrides same key)
MergeenvFileArray accumulation mergeAbsolute-path env files from global + runs.<name> + CLI
MergevolumesArray accumulation mergeAll mount volumes take effect
MergeportsArray accumulation mergeAll port mappings take effect (pass-through as --publish)
MergeimageBuildArgsArray accumulation mergeAll build arguments take effect

Debugging Configuration

Use the following commands to view the final effective configuration:

bash
# Display final configuration
manyoyo config show

# Display command to be executed
manyoyo config command

These debugging commands will display the merged results from all configuration sources, helping you understand the priority and merge logic of configurations.

Next Steps

Released under the MIT License.