MasterDraco 4c68a1ac07 Fix remote Transmission detection and config directory creation
- Fix bug where installer doesn't ask if Transmission is remote
- Fix missing configuration directory in /etc/transmission-rss-manager
- Create symlink between config locations to ensure app always finds config
- Ensure CONFIG_DIR is properly exported in the environment
- Update version to 2.0.4

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-05 08:39:21 +00:00

2.4 KiB

Changes for Moving Config File to /etc/transmission-rss-manager

Overview

This update moves the configuration file from the application directory to /etc/transmission-rss-manager/config.json for better system organization, while maintaining backward compatibility by checking the original location as a fallback.

Changes Made

1. Server.js Updates

  • Changed default config location to /etc/transmission-rss-manager/config.json
  • Added fallback location (path.join(__dirname, 'config.json')) for backward compatibility
  • Enhanced loadConfig() function to try primary location first, then fallback location
  • Updated saveConfig() function to try saving to primary location first, then fallback
  • Added installPath property to configuration to store the application installation path for easier updates

2. Installer Updates

  • Added CONFIG_DIR="/etc/transmission-rss-manager" variable to config-module.sh
  • Updated create_directories() in dependencies-module.sh to create the config directory
  • Updated permission settings to ensure proper access to config directory
  • Added checks for the CONFIG_DIR variable to ensure it's set
  • Modified service-setup-module.sh to include CONFIG_DIR in the environment variables for the systemd service
  • Updated file-creator-module.sh to write the initial config.json to the new location

3. Documentation Updates

  • Updated README.md to reflect new config file location
  • Added entry to the changelog for version 2.0.3
  • Updated code examples in README
  • Bumped version from 2.0.2 to 2.0.3 in both README.md and package.json

Technical Details

Config File Loading Process

  1. Try to load config from primary location (/etc/transmission-rss-manager/config.json)
  2. If not found, try fallback location (<install_dir>/config.json)
  3. If neither exists, create a new config file at primary location
  4. If primary location is not writable, fall back to application directory

Configuration Storage Logic

  • Primary storage location: /etc/transmission-rss-manager/config.json
  • Fallback location: <install_dir>/config.json
  • Automatic migration from fallback to primary when possible
  • Always try to write to primary first, then fallback if needed

Benefits

  • More standard Linux configuration location in /etc
  • Easier to find and edit configuration
  • Clear separation between code and configuration
  • Maintains backward compatibility with existing installations
  • Simplified update process by storing installation path