Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Export environment from service #12

Open
danyspin97 opened this issue Nov 6, 2020 · 0 comments
Open

Export environment from service #12

danyspin97 opened this issue Nov 6, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@danyspin97
Copy link
Owner

Some daemons export configuration variables into the environment. I think it could be useful to provide support for this use-case into the configuration. An example could be SWAYSOCK variable exported by sway that is needed by all wayland related daemons, like Waybar and mako.

I propose to add:

  • an export array in the options section to list all the environment to read once the service is started
  • an import array in the options section to list all the service to import the environment from

Example:

sway.user:

[main]
name = sway
description = ...
type = longrun

[run]
build = path
execute = sway

[options]
export =[ SWAYSOCK ]

Waybar.user:

[main]
name = Waybar
description = ...
type = longrun

[run]
build = path
execute = waybar

[options]
import =[ sway ]

/proc/$pid/environ can be used to read the environment as shown here. Knowing the $pid of a service is at the base of the supervision used so it can be assumed that it is correct.

A couple of issues:

  • Some services could want to export some dynamic environment variables to entire service tree of the user. E.g. a service could export all XDG environment variables. (for the static variable a different method should be added)
  • Is reading from /proc/$pid/environ portable?
@danyspin97 danyspin97 added the enhancement New feature or request label Nov 6, 2020
@danyspin97 danyspin97 added this to the First release milestone Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant