INNER CODE UNIT · Go

runJoinCommand

casosorg/casos · main.go:233

func runJoinCommand(args []string) int {
	if len(args) != 2 {
		fmt.Fprintln(os.Stderr, "usage: casos join <cloud address> <invite>")
		return 2
	}
	meshCfg, err := mesh.ConfigFromAppConf(conf.GetDataDir(), 0)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return 1
	}
	if meshCfg.Role != mesh.RoleStandalone {
		fmt.Fprintf(os.Stderr, "this CasOS is already a cloud %s\n", meshCfg.Role)
		return 1
	}
	hostname, _ := os.Hostname()
	ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
	defer cancel()
	m, err := mesh.Join(ctx, meshCfg, args[0], args[1], hostname, runtime.GOOS)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…