Skip to content

Add support for executing commands in Docker containers - #9

Open
Dimariqe wants to merge 1 commit into
gregtwallace:mainfrom
Dimariqe:command-docker
Open

Add support for executing commands in Docker containers#9
Dimariqe wants to merge 1 commit into
gregtwallace:mainfrom
Dimariqe:command-docker

Conversation

@Dimariqe

Copy link
Copy Markdown

This pull request adds support for executing custom commands inside Docker containers after certificate files are updated. It introduces new configuration options, updates the configuration parsing logic, and implements the command execution workflow, including error handling and logging.

Docker container command execution support:

  • Added new environment variable options (CW_CLIENT_0_COMMAND_DOCKER_CONTAINER0, etc.) to specify commands to run inside containers after cert updates, with format "container_name:command arg1 arg2".
  • Introduced a new containerCommand type and updated the certConfig struct to include a list of container commands (DockerContainerCommands). [1] [2]
  • Updated the configuration loader to parse the new container command environment variables, validate their format, and store them in the config. Docker API client initialization now also considers these commands.

Implementation of command execution:

  • Added the executeDockerContainerCommands method to asynchronously execute specified commands inside containers, log output, and handle errors and exit codes.
  • Integrated command execution into the certificate update workflow, so commands are only run when files are actually changed.

Introduces the ability to specify commands to execute inside Docker containers after certificate updates via new environment variables (CW_CLIENT_0_COMMAND_DOCKER_CONTAINER*). Adds parsing, configuration, and async execution of these commands, with logging of results. Commands are only executed if certificate files are updated.
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.

1 participant