forked from toolshed/abra
refactor: apps -> recipes
This commit is contained in:
@ -135,7 +135,7 @@ func LoadAppFiles(servers ...string) (AppFiles, error) {
|
||||
if servers[0] == "" {
|
||||
// Empty servers flag, one string will always be passed
|
||||
var err error
|
||||
servers, err = GetAllFoldersInDirectory(ABRA_SERVER_FOLDER)
|
||||
servers, err = GetAllFoldersInDirectory(SERVERS_DIR)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -145,14 +145,14 @@ func LoadAppFiles(servers ...string) (AppFiles, error) {
|
||||
logrus.Debugf("collecting metadata from %v servers: %s", len(servers), strings.Join(servers, ", "))
|
||||
|
||||
for _, server := range servers {
|
||||
serverDir := path.Join(ABRA_SERVER_FOLDER, server)
|
||||
serverDir := path.Join(SERVERS_DIR, server)
|
||||
files, err := getAllFilesInDirectory(serverDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, file := range files {
|
||||
appName := strings.TrimSuffix(file.Name(), ".env")
|
||||
appFilePath := path.Join(ABRA_SERVER_FOLDER, server, file.Name())
|
||||
appFilePath := path.Join(SERVERS_DIR, server, file.Name())
|
||||
appFiles[appName] = AppFile{
|
||||
Path: appFilePath,
|
||||
Server: server,
|
||||
@ -248,8 +248,8 @@ func GetAppNames() ([]string, error) {
|
||||
}
|
||||
|
||||
// TemplateAppEnvSample copies the example env file for the app into the users env files
|
||||
func TemplateAppEnvSample(recipe, appName, server, domain string) error {
|
||||
envSamplePath := path.Join(ABRA_DIR, "apps", recipe, ".env.sample")
|
||||
func TemplateAppEnvSample(recipeName, appName, server, domain string) error {
|
||||
envSamplePath := path.Join(RECIPES_DIR, recipeName, ".env.sample")
|
||||
envSample, err := ioutil.ReadFile(envSamplePath)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -260,7 +260,7 @@ func TemplateAppEnvSample(recipe, appName, server, domain string) error {
|
||||
return fmt.Errorf("%s already exists?", appEnvPath)
|
||||
}
|
||||
|
||||
envSample = []byte(strings.Replace(string(envSample), fmt.Sprintf("%s.example.com", recipe), domain, -1))
|
||||
envSample = []byte(strings.Replace(string(envSample), fmt.Sprintf("%s.example.com", recipeName), domain, -1))
|
||||
envSample = []byte(strings.Replace(string(envSample), "example.com", domain, -1))
|
||||
|
||||
err = ioutil.WriteFile(appEnvPath, envSample, 0664)
|
||||
@ -336,7 +336,7 @@ func GetAppComposeFiles(recipe string, appEnv AppEnv) ([]string, error) {
|
||||
|
||||
if _, ok := appEnv["COMPOSE_FILE"]; !ok {
|
||||
logrus.Debug("no COMPOSE_FILE detected, loading compose.yml")
|
||||
path := fmt.Sprintf("%s/%s/compose.yml", APPS_DIR, recipe)
|
||||
path := fmt.Sprintf("%s/%s/compose.yml", RECIPES_DIR, recipe)
|
||||
composeFiles = append(composeFiles, path)
|
||||
return composeFiles, nil
|
||||
}
|
||||
@ -345,7 +345,7 @@ func GetAppComposeFiles(recipe string, appEnv AppEnv) ([]string, error) {
|
||||
envVars := strings.Split(composeFileEnvVar, ":")
|
||||
logrus.Debugf("COMPOSE_FILE detected (%s), loading %s", composeFileEnvVar, strings.Join(envVars, ", "))
|
||||
for _, file := range strings.Split(composeFileEnvVar, ":") {
|
||||
path := fmt.Sprintf("%s/%s/%s", APPS_DIR, recipe, file)
|
||||
path := fmt.Sprintf("%s/%s/%s", RECIPES_DIR, recipe, file)
|
||||
composeFiles = append(composeFiles, path)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user