forked from toolshed/abra
WIP: still hacking on the app new command
Finally had to fork godotenv because it strips comments and we need
those to parse length values (e.g. "FOO=v1 # length=10") (or in other
words, motivation to move to the YAML format).
There is a new secret module now, with functionality for dealing with
generation and parsing of secrets.
The final output needs some work and there is also the final step of
implementing the sending of secrets to the docker daemon. Coming Soon
™️.
This commit is contained in:
@ -12,10 +12,10 @@ import (
|
||||
"strings"
|
||||
|
||||
"coopcloud.tech/abra/client"
|
||||
"github.com/Autonomic-Cooperative/godotenv"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -200,6 +200,22 @@ func GetAppStatuses(appFiles AppFiles) (map[string]string, error) {
|
||||
return statuses, nil
|
||||
}
|
||||
|
||||
func CopyAppEnvSample(appType, appName, server string) error {
|
||||
envSamplePath := path.Join(ABRA_DIR, "apps", appType, ".env.sample")
|
||||
envSample, err := ioutil.ReadFile(envSamplePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
appEnvPath := path.Join(ABRA_DIR, "servers", server, fmt.Sprintf("%s.env", appName))
|
||||
err = ioutil.WriteFile(appEnvPath, envSample, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: maybe better names than read and get
|
||||
|
||||
func readAppFile(appFile AppFile, name AppName) (App, error) {
|
||||
|
Reference in New Issue
Block a user