WIP spec out app new command

This commit is contained in:
decentral1se 2021-07-28 14:26:37 +02:00
parent bf7d437571
commit de3ea8188e
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 27 additions and 2 deletions

View File

@ -20,14 +20,15 @@ import (
var appNewCommand = &cli.Command{
Name: "new",
Usage: "Create a new app",
Usage: "Create a new app of <type>",
Description: `
This command takes a recipe and uses it to cook up a new app. This app
configuration is stored in your ~/.abra directory under the appropriate server.
This command does not deploy your app for you. You will need to run "abra app
deploy <app>" to do so.
You can see what apps can be created by running "abra recipe ls".
You can see what apps can be created (i.e. values for the <type> argument) by
running "abra recipe ls".
Passing the "--secrets" flag will automatically generate secrets for your app
and store them encrypted at rest on the chosen target server. These generated
@ -42,6 +43,30 @@ locally in a pass store (see passwordstore.org for more).
PassFlag,
SecretsFlag,
},
ArgsUsage: "<type>",
Action: func(c *cli.Context) error {
appType := c.Args().First()
if appType == "" {
cli.ShowSubcommandHelp(c)
return nil
}
// TODO:
// ensure ABRA_DIR exists
// get the apps_json
// get the servers list
// select latest version of recipe from apps_json
// prompt to choose server if not provided
// prompt to choose domain name if not provided
// prompt to choose app name if not provided
// convert name and truncate or error out if needed
// cp over env.sample and do some sed/replacing
// generate secrets if asked to do so
// save them in a pass store if asked to do so
// Output some instructions on how to deploy this thing
return nil
},
}
var appDeployCommand = &cli.Command{
Name: "deploy",