@@ -31,6 +31,10 @@ import (
3131 "github.com/urfave/cli/v3"
3232)
3333
34+ var (
35+ ErrNoProjectSelected = errors .New ("no project selected" )
36+ )
37+
3438var (
3539 template * bootstrap.Template
3640 templateName string
4953 {
5054 Name : "create" ,
5155 Usage : "Bootstrap a new application from a template or through guided creation" ,
52- Before : requireProject ,
5356 Action : setupTemplate ,
5457 ArgsUsage : "`APP_NAME`" ,
5558 Flags : []cli.Flag {
@@ -150,7 +153,7 @@ func requireProject(ctx context.Context, cmd *cli.Command) (context.Context, err
150153 if len (cliConfig .Projects ) > 0 {
151154 var options []huh.Option [* config.ProjectConfig ]
152155 for _ , p := range cliConfig .Projects {
153- options = append (options , huh .NewOption (p .Name + " [" + p . APIKey + "]" , & p ))
156+ options = append (options , huh .NewOption (p .Name + " [" + util . ExtractSubdomain ( p . URL ) + "]" , & p ))
154157 }
155158 if err = huh .NewForm (
156159 huh .NewGroup (huh .NewSelect [* config.ProjectConfig ]().
@@ -179,7 +182,7 @@ func requireProject(ctx context.Context, cmd *cli.Command) (context.Context, err
179182 }
180183 return requireProject (ctx , cmd )
181184 } else {
182- return nil , errors . New ( "no project selected" )
185+ return nil , ErrNoProjectSelected
183186 }
184187 }
185188 }
@@ -413,12 +416,21 @@ func manageEnv(ctx context.Context, cmd *cli.Command) error {
413416}
414417
415418func instantiateEnv (ctx context.Context , cmd * cli.Command , rootPath string , addlEnv * map [string ]string , exampleFile string ) (map [string ]string , error ) {
416- env := map [string ]string {
417- "LIVEKIT_API_KEY" : project .APIKey ,
418- "LIVEKIT_API_SECRET" : project .APISecret ,
419- "LIVEKIT_URL" : project .URL ,
420- "NEXT_PUBLIC_LIVEKIT_URL" : project .URL ,
419+ env := map [string ]string {}
420+ if _ , err := requireProject (ctx , cmd ); err != nil {
421+ if ! errors .Is (err , ErrNoProjectSelected ) {
422+ return nil , err
423+ }
424+ // if no project is selected, we prompt for all environment variables including LIVEKIT_ ones
425+ } else {
426+ env = map [string ]string {
427+ "LIVEKIT_API_KEY" : project .APIKey ,
428+ "LIVEKIT_API_SECRET" : project .APISecret ,
429+ "LIVEKIT_URL" : project .URL ,
430+ "NEXT_PUBLIC_LIVEKIT_URL" : project .URL ,
431+ }
421432 }
433+
422434 if addlEnv != nil {
423435 for k , v := range * addlEnv {
424436 env [k ] = v
0 commit comments