Skip to content

Conversation

@ximon18
Copy link
Member

@ximon18 ximon18 commented Sep 9, 2025

Receive pre-bound UDP and TCP sockets via the LISTEN_FDS environment variable.

See NLnetLabs/cascade#53 for this branch in use.

Receive pre-bound UDP and TCP sockets via the LISTEN_FDS environment
variable.
@ximon18 ximon18 requested a review from partim September 9, 2025 18:38
@ximon18 ximon18 added the enhancement New feature or request label Sep 9, 2025
@ximon18
Copy link
Member Author

ximon18 commented Sep 9, 2025

Damn, my editor has reformatted more than just the changes I made. I'll resubmit that without the extra changes.

@ximon18
Copy link
Member Author

ximon18 commented Sep 9, 2025

Damn, my editor has reformatted more than just the changes I made. I'll resubmit that without the extra changes.

Fixed.

src/process.rs Outdated
/// as it calls [`std::env::remove_var()`].
pub fn from_env(unset_environment: bool) -> Self {
let own_pid = nix::unistd::Pid::this().as_raw().to_string();
let var_pid = std::env::var("LISTEN_PID").unwrap_or_default();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think env::var_os will be enough here, sparing us one check (not that it matters much).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you would lose the knowledge that the var was not set, which if you expect it to be set could be important to know.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you unwrap_or_default anyway? Or am I missing something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code has since changed. It not captures the unset env var case as EnvSocketsError::NotAvailable.

@partim partim merged commit 6cc4f9b into main Sep 18, 2025
24 checks passed
@partim partim deleted the add-systemd-socket-via-env-support branch September 18, 2025 09:30
partim added a commit that referenced this pull request Sep 29, 2025
New

* Reworked setting of user and group. If not provided explicitly, the
  group will now be set to the user’s group. The list of supplemental
  groups will be initialized from the user’s group list. ([#11])
* Allow manually creating the process configuration so it can be used
  without the _clap_ argument parser. ([#12])
* Added support for systemd’s socket activation. ([#13])
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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants