Skip to content

Settings

Global configuration for fscm behavior.

Accessing Settings

import fscm

# Access the global settings object
fscm.settings.dry_run = True

Available Settings

dry_run

Simulate operations without making changes.

fscm.settings.dry_run = True
Type Default
bool False

When enabled: - Files are not written - Commands are not executed - Packages are not installed - Changes are still tracked in CHANGELIST


sudo_password

Password for sudo operations.

fscm.settings.sudo_password = "password"
Type Default
str None

Security

Avoid hardcoding passwords. Use environment variables:

import os
fscm.settings.sudo_password = os.environ.get("SUDO_PASSWORD")


stream_output

Show command output in real-time.

fscm.settings.stream_output = True
Type Default
bool True

backup_dir

Directory for file backups.

fscm.settings.backup_dir = Path("/var/backups/fscm")
Type Default
Path ~/.fscm/backups

backup_threshold

Maximum file size to backup (bytes).

fscm.settings.backup_threshold = 1024 * 1024  # 1MB
Type Default
int 1048576 (1MB)

Set to None to disable backups:

fscm.settings.backup_threshold = None

prefix

Path prefix for all file operations.

fscm.settings.prefix = "/opt/myapp"
Type Default
Path None

When set, all relative paths are resolved against this prefix.


container_cmd

Docker or podman command.

fscm.settings.container_cmd = "podman"
Type Default
str "docker"

system

Override detected system type.

fscm.settings.system = fscm.Debian()
Type Default
UnixSystem Auto-detected

Example: Production Configuration

import os
import fscm
from pathlib import Path

# Disable dry-run for actual deployment
fscm.settings.dry_run = False

# Use environment variable for sudo password
fscm.settings.sudo_password = os.environ.get("SUDO_PASSWORD")

# Configure backups
fscm.settings.backup_dir = Path("/var/backups/fscm")
fscm.settings.backup_threshold = 10 * 1024 * 1024  # 10MB max

# Show output
fscm.settings.stream_output = True

Example: Testing Configuration

import fscm
from pathlib import Path
import tempfile

# Enable dry-run for testing
fscm.settings.dry_run = True

# Use temp directory for backups
fscm.settings.backup_dir = Path(tempfile.mkdtemp())

# Suppress output
fscm.settings.stream_output = False