( ctx context.Context, ce *clienv.CliEnv, )
| 158 | } |
| 159 | |
| 160 | func InitRemote( |
| 161 | ctx context.Context, |
| 162 | ce *clienv.CliEnv, |
| 163 | ) error { |
| 164 | ep, err := ce.ResolveProject(ctx, "") |
| 165 | if err != nil { |
| 166 | return fmt.Errorf("failed to resolve project: %w", err) |
| 167 | } |
| 168 | |
| 169 | cfg, err := config.Pull(ctx, ce, ep.App, true) |
| 170 | if err != nil { |
| 171 | return fmt.Errorf("failed to pull config: %w", err) |
| 172 | } |
| 173 | |
| 174 | if err := initInit(ce.Path); err != nil { |
| 175 | return err |
| 176 | } |
| 177 | |
| 178 | adminSecret, err := ep.AdminSecret(ctx) |
| 179 | if err != nil { |
| 180 | return fmt.Errorf("failed to get admin secret: %w", err) |
| 181 | } |
| 182 | |
| 183 | if err := deploy(ctx, ce, cfg, ep.HasuraURL, adminSecret); err != nil { |
| 184 | return fmt.Errorf("failed to deploy: %w", err) |
| 185 | } |
| 186 | |
| 187 | ce.Infoln("Project initialized successfully!") |
| 188 | |
| 189 | return nil |
| 190 | } |
| 191 | |
| 192 | func deploy( |
| 193 | ctx context.Context, |
no test coverage detected