Skip to content

Conversation

@cmainas
Copy link
Collaborator

@cmainas cmainas commented Oct 20, 2025

Add support for reading the environment variables and the execution environment configuration from a config file. Based on this config, set up the execution environment for the application to run. The configuration file is determined by the URUNIT_CONFIG environment variable. If this environment variable is not set, then urunit will simply continue the execution of the application.
If it is set, then it should point to a config file with the following format:

UES
/* list of environment variables */
UEE
UCS
UID: uid for the application
GID: gid for the application
WD:  working directory
UCE

Based on the above configuration, urunit sets up the environment variables and uid,gid, working directory for the application execution. Furthermore, if the PATH environment variable exists in the environment variables list, then urunit will use this environment variable to find the full path of the application binary, using a simple implementation of execvpe().

Add support for printing debug messages when DEBUG is enbaled at build
time. For easier usage, the make targets urunit_static_debug and
urunit_dynamic_debug, produce binaries with debug messages enabled.

Furthermore, add a few debug messages in the whole execution.

Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Separate the logic of the child, after the fork,  in a separate
function.

Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Add support for reading the environment variables from a config file
which is defined by the environment variable "URUNIT_CONFIG". If this
environment variable is not set, then urunit follows the previous
execution path and execs the app using the existing environment
variables.

If the environment variable sis set then it should point to the
configuration file with the environment variables. The environment
variables are in a list which starts with the special string "UES" and
ends with the special string "UEE". For instance a valid list is the
following:

UES
PATH=/bin
MYENV=myvalue
UEE

urunit will set these environment variables for the execution of the
application and in case PATH was set, it will use this environment
variable to search for the full path othe application's binary.

Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
In a similar way with environment variables, read the execution
environment configuration from the configuration file. The respective
config for the execution environment should have the following format:

UCS
UID:<uid>
GID:<gid>
WD: <working_directory>
UCE

Given such a configuration, urunit will set the gid then the uid and at
last switch to the working_directory.

Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
@cmainas cmainas force-pushed the feat_app_env_config branch 4 times, most recently from e19d835 to 02424c3 Compare October 22, 2025 17:15
@cmainas cmainas marked this pull request as ready for review October 22, 2025 17:17
@cmainas cmainas merged commit d2243a4 into main Oct 23, 2025
4 checks passed
@cmainas cmainas deleted the feat_app_env_config branch October 23, 2025 07:38
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.

2 participants