func checkAppAndChain(app *definitions.Contracts, name string) error { var chain string // name is pulled in from the do struct. need to work with both // it (as an override) and the app.ChainName switch name { case "": if app.ChainName == "" { return nil } else { chain = app.ChainName } case "t", "tmp", "temp": return nil default: chain = name } if strings.Contains(app.Name, " ") { app.Name = strings.Replace(app.Name, " ", "_", -1) } // this is hacky.... at best. if len(app.AppType.ChainTypes) == 1 && app.AppType.ChainTypes[0] == "eth" { if r := regexp.MustCompile("eth"); r.MatchString(chain) { return nil } else { return fmt.Errorf("The marmots detected a disturbance in the force.\n\nYou asked them to run the App Type: (%s).\nBut the chainName (%s) doesn't contain the name (%s).\nPlease rename the chain or service to contain the name (%s)", app.AppType.Name, chain, "eth", "eth") } } return nil }