fix: allow renaming old applications to new format
0.22.0 changed allowed values for app names, making it more difficult for users to fix their app names - you need to either downgrade+rename or recreate the app. The `apps:rename` command can now rename these old applications to the new standard. Also drop some app name verification from internal commands. Duplicate verification doesn't help much, and though it isn't excessively slow, it does prevent us from running commands against old apps that exist. Refs #4267
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
@@ -145,9 +144,14 @@ func getEnvironment(appName string, merged bool) (env *Env) {
|
||||
}
|
||||
|
||||
func getAppNameOrGlobal(appName string, global bool) (string, error) {
|
||||
if appName == "" && !global {
|
||||
return appName, errors.New("Please specify an app to run the command on or --global")
|
||||
if global {
|
||||
return appName, nil
|
||||
}
|
||||
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
return appName, err
|
||||
}
|
||||
|
||||
return appName, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,10 @@ func newEnvFromString(rep string) (env *Env, err error) {
|
||||
|
||||
//LoadAppEnv loads an environment for the given app
|
||||
func LoadAppEnv(appName string) (env *Env, err error) {
|
||||
err = common.VerifyAppName(appName)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
appfile, err := getAppFile(appName)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user