aboutsummaryrefslogtreecommitdiff
path: root/pkg/domain
diff options
context:
space:
mode:
authorToshiki Sonoda <sonoda.toshiki@fujitsu.com>2022-09-02 16:20:26 +0900
committerToshiki Sonoda <sonoda.toshiki@fujitsu.com>2022-09-06 20:17:11 +0900
commita9a411f8a83ab5644582b8929a32abacc18a17fc (patch)
treee94196c3d5f7936f55d36041c67276dcb0a980ae /pkg/domain
parent9ab6449e36792734853eb59161ccd3bfe5d0d509 (diff)
downloadpodman-a9a411f8a83ab5644582b8929a32abacc18a17fc.tar.gz
podman-a9a411f8a83ab5644582b8929a32abacc18a17fc.tar.bz2
podman-a9a411f8a83ab5644582b8929a32abacc18a17fc.zip
Add generate systemd -e/--env option
-e/--env option sets environment variables to the systemd unit files. Fixes: #15523 Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
Diffstat (limited to 'pkg/domain')
-rw-r--r--pkg/domain/entities/generate.go43
-rw-r--r--pkg/domain/infra/tunnel/generate.go3
2 files changed, 17 insertions, 29 deletions
diff --git a/pkg/domain/entities/generate.go b/pkg/domain/entities/generate.go
index f18e79b47..314996497 100644
--- a/pkg/domain/entities/generate.go
+++ b/pkg/domain/entities/generate.go
@@ -4,34 +4,21 @@ import "io"
// GenerateSystemdOptions control the generation of systemd unit files.
type GenerateSystemdOptions struct {
- // Name - use container/pod name instead of its ID.
- Name bool
- // New - create a new container instead of starting a new one.
- New bool
- // RestartPolicy - systemd restart policy.
- RestartPolicy *string
- // RestartSec - systemd service restartsec. Configures the time to sleep before restarting a service.
- RestartSec *uint
- // StartTimeout - time when starting the container.
- StartTimeout *uint
- // StopTimeout - time when stopping the container.
- StopTimeout *uint
- // ContainerPrefix - systemd unit name prefix for containers
- ContainerPrefix string
- // PodPrefix - systemd unit name prefix for pods
- PodPrefix string
- // Separator - systemd unit name separator between name/id and prefix
- Separator string
- // NoHeader - skip header generation
- NoHeader bool
- // TemplateUnitFile - make use of %i and %I to differentiate between the different instances of the unit
- TemplateUnitFile bool
- // Wants - systemd wants list for the container or pods
- Wants []string
- // After - systemd after list for the container or pods
- After []string
- // Requires - systemd requires list for the container or pods
- Requires []string
+ Name bool
+ New bool
+ RestartPolicy *string
+ RestartSec *uint
+ StartTimeout *uint
+ StopTimeout *uint
+ ContainerPrefix string
+ PodPrefix string
+ Separator string
+ NoHeader bool
+ TemplateUnitFile bool
+ Wants []string
+ After []string
+ Requires []string
+ AdditionalEnvVariables []string
}
// GenerateSystemdReport
diff --git a/pkg/domain/infra/tunnel/generate.go b/pkg/domain/infra/tunnel/generate.go
index ed63d363a..d3c3638cb 100644
--- a/pkg/domain/infra/tunnel/generate.go
+++ b/pkg/domain/infra/tunnel/generate.go
@@ -19,7 +19,8 @@ func (ic *ContainerEngine) GenerateSystemd(ctx context.Context, nameOrID string,
WithSeparator(opts.Separator).
WithWants(opts.Wants).
WithAfter(opts.After).
- WithRequires(opts.Requires)
+ WithRequires(opts.Requires).
+ WithAdditionalEnvVariables(opts.AdditionalEnvVariables)
if opts.StartTimeout != nil {
options.WithStartTimeout(*opts.StartTimeout)