Search code examples
haxe

Using haxe to edit remote file?


I've searched in haxelib for a library to use for remotely editing a file on a server using ssh connection with haxe, or listing files in directory..

Has any one done this with haxe?


Solution

  • I want to build a desktop app to create a yaml editor that will change settings files of several servers using a frontend like haxe-ui.

    Ok, there are probably a lot of ways you could do it, but I would suggest separating your concerns:

    desktop app to create a yaml editor

    Ok, that's a fine use case for Haxe / a programming language. Build an editor, check.

    change settings files (located on) several servers

    Ok, so you have options here. Either

    1. Make the remote files appear as local files via some network file system, or
    2. Copy the files locally, edit them , and copy them back, or
    3. Roll your own network-enabled service that runs on each server, receives commands, and modifies the files.

    Random aside: Given that these are settings files, you probably also want to restart some service after changes are made.

    I'd say option 2 is the easiest. There are even many ways to do that:

    1. Use scp to both bring the settings files to a local location, edit them locally, and then push them back. And if you setup SSH keys, you won't have to bother with passwords.

    2. Netcat is another tool for pushing bytes (aka files) over the network. It's simpler than scp, but with no security measures.

    Or, get creative / crazy, and say, "my settings files will all be stored in a git repo. The 'sync' process will be a push / pull setup."

    There are simply lots of ways to get this done.