NOT WORKING: WIP on adding server-wide logs functionality

This commit is contained in:
2021-12-03 10:32:58 +01:00
parent 236d0f5892
commit ed859c0243
3 changed files with 131 additions and 0 deletions

View File

@ -112,6 +112,35 @@ func ValidateApp(c *cli.Context) config.App {
return app
}
// ValidateAppByName ensures the app is valid and takes an app name as an argument, not context.
func ValidateAppByName(c *cli.Context, appName string) config.App {
if AppName != "" {
appName = AppName
logrus.Debugf("programmatically setting app name to %s", appName)
}
if appName == "" {
ShowSubcommandHelpAndError(c, errors.New("no app provided"))
}
app, err := app.Get(appName)
if err != nil {
logrus.Fatal(err)
}
if err := recipe.EnsureExists(app.Type); err != nil {
logrus.Fatal(err)
}
if err := ssh.EnsureHostKey(app.Server); err != nil {
logrus.Fatal(err)
}
logrus.Debugf("validated '%s' as app argument", appName)
return app
}
// ValidateDomain ensures the domain name arg is valid.
func ValidateDomain(c *cli.Context) (string, error) {
domainName := c.Args().First()