Skip to content

[FEAT] Provide Additional Environment Variable for SSH Port #1026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
a-priestley opened this issue Apr 19, 2025 · 2 comments
Open
1 task done

[FEAT] Provide Additional Environment Variable for SSH Port #1026

a-priestley opened this issue Apr 19, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@a-priestley
Copy link

Is this a new feature request?

  • I have searched the existing issues

Name of mod

jellyfin-rffmpeg

Wanted change

Expose a new environment variable for initial rffmpeg setup, appending to rffmpeg.yml:

---
...
rffmpeg:
  ...
  remote:
    ...
    args:
      ...
      - "-p"
      - "<port>"
...

Reason for change

Currently, if your target rffmpeg host exposes sshd on a port other than 22, rffmpeg.yml on the client must be modified after initial setup.
Adding a new variable for initial setup (I suggest RFFMPEG_PORT) to be captured and processed by init-mod-jellyfin-rffmpeg-setup/run would automate this step.

Proposed code change

I'm not too familiar with sed -- not sure if this is correct but I will test.

...
sed -i 's~#    - "/var/lib/jellyfin/id_rsa"~    - "/config/rffmpeg/.ssh/id_rsa"~' /config/rffmpeg/rffmpeg.yml
if [ ! -z "$RFFMPEG_PORT" ]; then
    sed -i 's~#    - "-p"~    - "-p"~' /config/rffmpeg/rffmpeg.yml
    sed -i "s~#    - $RFFMPEG_PORT~    - $RFFMPEG_PORT~" /config/rffmpeg/rffmpeg.yml
fi
...

We will likely also want to ensure that, if the service is reconfigured without the variable after previously including it, these lines are removed from the file:

...
else
    sed "args that remove the line with the port flag"
    sed "args that remove the line with the port value"
fi
...

Or we could default the variable to 22 and remove the check altogether.

@a-priestley a-priestley added the enhancement New feature or request label Apr 19, 2025
@aptalca
Copy link
Member

aptalca commented Apr 19, 2025

You can always edit the yaml as it's in the config folder and add any custom args you need.
The current logic doesn't allow for changing vars after they've been set anyway. The init logic is pretty barebones.

The maintainer is @junkman690

@junkman690
Copy link

junkman690 commented May 1, 2025

@a-priestley agree with @aptalca that this would not work with the current setup. You can add any SSH args into the config file easily as its exposed to host, and the default config does not have any port flags in it (it is direct from the upstream rffmpeg project and is a little out of date but can easily be updated manually if there are any options the end user wants to set). I would be reluctant to have manual downstream additions to the default config file.

Alternatively, as I don't actively use this mod anymore, would be happy for you to submit a pull request with a updated logic to sed the existing file and add port options in if it is set as an env eg.

if [ ! -z "$RFFMPEG_PORT" ]; then
    sed -i "\~    - \"/config/rffmpeg/.ssh/id_rsa\"~a\\    -p $RFFMPEG_PORT" /config/rffmpeg/rffmpeg.yml
fi

In https://github.com/linuxserver/docker-mods/blob/jellyfin-rffmpeg/root/etc/s6-overlay/s6-rc.d/init-mod-jellyfin-rffmpeg-setup/run along with appropriate README updates.

Please note as mentioned this would not update any existing config file so is for new installs only. Eg. code has also not been tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Issues
Development

No branches or pull requests

3 participants