refactor: use log:set for logs and add global support

This commit is contained in:
Jose Diaz-Gonzalez
2021-01-22 00:39:08 -05:00
parent 6eb0bd8c87
commit afe1e8b33c
11 changed files with 212 additions and 26 deletions

View File

@@ -2,12 +2,33 @@ package logs
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"github.com/dokku/dokku/plugins/common"
)
// TriggerDockerArgsProcessDeploy outputs the logs plugin docker options for an app
func TriggerDockerArgsProcessDeploy(appName string) error {
stdin, err := ioutil.ReadAll(os.Stdin)
if err != nil {
return err
}
maxSize := common.PropertyGet("logs", appName, "max-size")
if maxSize == "" {
maxSize = common.PropertyGetDefault("logs", "--global", "max-size", MaxSize)
}
if maxSize != "unlimited" {
fmt.Printf(" --log-opt max-size=%s ", maxSize)
}
fmt.Print(string(stdin))
return nil
}
// TriggerInstall initializes app restart policies
func TriggerInstall() error {
if err := common.PropertySetup("logs"); err != nil {