@@ -69,6 +69,11 @@ func NewApp() *cli.App {
6969 EnvVars : []string {"CREATEOS_SANDBOX_GATEWAY" },
7070 Value : "gateway.sb.createos.sh:2222" ,
7171 },
72+ & cli.StringFlag {
73+ Name : "api-key" ,
74+ Usage : "API key for authentication (overrides stored token)" ,
75+ EnvVars : []string {"CREATEOS_API_KEY" },
76+ },
7277 & cli.StringFlag {
7378 Name : "output" ,
7479 Aliases : []string {"o" },
@@ -100,7 +105,16 @@ func NewApp() *cli.App {
100105 return nil
101106 }
102107
103- // Try OAuth session first
108+ // CREATEOS_API_KEY env var (or --api-key flag) — injected by Stripe Projects
109+ if apiKey := c .String ("api-key" ); apiKey != "" {
110+ client := api .NewClient (apiKey , c .String ("api-url" ), c .Bool ("debug" ))
111+ c .App .Metadata [api .ClientKey ] = & client
112+ sandboxClient := api .NewSandboxClient (apiKey , c .String ("sandbox-api-url" ), c .Bool ("debug" ))
113+ c .App .Metadata [api .SandboxClientKey ] = & sandboxClient
114+ return nil
115+ }
116+
117+ // Try OAuth session
104118 if config .HasOAuthSession () {
105119 session , err := config .LoadOAuthSession ()
106120 if err != nil {
@@ -133,7 +147,7 @@ func NewApp() *cli.App {
133147 }
134148 }
135149
136- // Fall back to API key
150+ // Fall back to stored token (~/.createos/.token)
137151 token , err := config .LoadToken ()
138152 if err != nil {
139153 return err
0 commit comments