Minimize code duplication for environment variables; ref pterodactyl/panel#2255
This commit is contained in:
@@ -148,7 +148,7 @@ func (e *Environment) Create() error {
|
||||
Tty: true,
|
||||
ExposedPorts: a.Exposed(),
|
||||
Image: e.meta.Image,
|
||||
Env: e.variables(),
|
||||
Env: e.Configuration.EnvironmentVariables(),
|
||||
Labels: map[string]string{
|
||||
"Service": "Pterodactyl",
|
||||
"ContainerType": "server_process",
|
||||
@@ -204,12 +204,6 @@ func (e *Environment) Create() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *Environment) variables() []string {
|
||||
v := e.Configuration.EnvironmentVariables()
|
||||
|
||||
return append(v, fmt.Sprintf("STARTUP=%s", e.meta.Invocation))
|
||||
}
|
||||
|
||||
func (e *Environment) convertMounts() []mount.Mount {
|
||||
var out []mount.Mount
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
)
|
||||
|
||||
type Metadata struct {
|
||||
Invocation string
|
||||
Image string
|
||||
Stop *api.ProcessStopConfiguration
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func (e *Environment) OnBeforeStart() error {
|
||||
// the Panel is usee.
|
||||
if err := e.client.ContainerRemove(context.Background(), e.Id, types.ContainerRemoveOptions{RemoveVolumes: true}); err != nil {
|
||||
if !client.IsErrNotFound(err) {
|
||||
return err
|
||||
return errors.Wrap(err, "failed to remove server docker container during pre-boot")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user