Skip to content

refactor: centralize system paths and SSH key discovery #134

Merged
Cleboost merged 1 commit into
masterfrom
refactor/centralize-paths
May 10, 2026
Merged

refactor: centralize system paths and SSH key discovery #134
Cleboost merged 1 commit into
masterfrom
refactor/centralize-paths

Conversation

@Cleboost
Copy link
Copy Markdown
Owner

This pull request refactors SSH key management and related constants to centralize logic, improve maintainability, and ensure consistent usage of SSH directory paths across the codebase. The main changes involve moving SSH key utilities and constants to config_observer.rs, updating references throughout the application, and enhancing user-facing messages for clarity.

SSH Key Management Refactor:

  • Moved the SshKeyPair struct, get_ssh_dir, and load_ssh_keys functions from ui/ssh_keys.rs to config_observer.rs, consolidating SSH key logic in a single location. ([[1]](https://github.com/Cleboost/Rustmius/pull/134/files#diff-62a48d93070189103c8bcddc6c959538d130cbd7c9349316fa20fc3575caa25cR17-R56), [[2]](https://github.com/Cleboost/Rustmius/pull/134/files#diff-4750f20168a2936759b01f845a100a3b1044258228152af5e6519aa82463a7aaL35-L69))
  • Updated imports and function calls in ui/ssh_keys.rs and add_server_dialog.rs to use the new centralized definitions from config_observer.rs. ([[1]](https://github.com/Cleboost/Rustmius/pull/134/files#diff-4750f20168a2936759b01f845a100a3b1044258228152af5e6519aa82463a7aaL6-R6), [[2]](https://github.com/Cleboost/Rustmius/pull/134/files#diff-d99b8afb47f078a6bc7632396dc533fdb025c64fc50ed134a142d46c4d9c6d09L3-R3))

SSH Directory Constants and Usage:

  • Introduced constants REMOTE_SSH_DIR, REMOTE_AUTHORIZED_KEYS, and REMOTE_SSH_CONFIG in config_observer.rs for consistent referencing of SSH-related paths. ([src/config_observer.rsR17-R56](https://github.com/Cleboost/Rustmius/pull/134/files#diff-62a48d93070189103c8bcddc6c959538d130cbd7c9349316fa20fc3575caa25cR17-R56))
  • Updated the SSH public key deployment command in ssh_engine.rs to use these new constants, ensuring path correctness and maintainability. ([[1]](https://github.com/Cleboost/Rustmius/pull/134/files#diff-f48442d6fe3dd48b17416029df81da8c6b5451d004bbd8cd074a377dfed85b5eL5-R5), [[2]](https://github.com/Cleboost/Rustmius/pull/134/files#diff-f48442d6fe3dd48b17416029df81da8c6b5451d004bbd8cd074a377dfed85b5eL72-R76))

UI Improvements:

  • Updated user-facing messages in the SSH keys UI to dynamically display the correct SSH directory path using the new constants, improving clarity for users. ([[1]](https://github.com/Cleboost/Rustmius/pull/134/files#diff-4750f20168a2936759b01f845a100a3b1044258228152af5e6519aa82463a7aaL119-R82), [[2]](https://github.com/Cleboost/Rustmius/pull/134/files#diff-4750f20168a2936759b01f845a100a3b1044258228152af5e6519aa82463a7aaL424-R387), [[3]](https://github.com/Cleboost/Rustmius/pull/134/files#diff-4750f20168a2936759b01f845a100a3b1044258228152af5e6519aa82463a7aaL543-R506))

Other Improvements:

  • Refactored get_default_config_path in config_observer.rs to use the new get_ssh_dir function for consistency. ([src/config_observer.rsL70-R110](https://github.com/Cleboost/Rustmius/pull/134/files#diff-62a48d93070189103c8bcddc6c959538d130cbd7c9349316fa20fc3575caa25cL70-R110))

These changes collectively improve code organization, reduce duplication, and make the handling of SSH keys and paths more robust and user-friendly.

@Cleboost Cleboost merged commit ce2ab67 into master May 10, 2026
1 check passed
@Cleboost Cleboost deleted the refactor/centralize-paths branch May 10, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant