( ctx context.Context, ce *clienv.CliEnv, proj *graphql.AppSummaryFragment, )
| 134 | } |
| 135 | |
| 136 | func pullSecrets( |
| 137 | ctx context.Context, |
| 138 | ce *clienv.CliEnv, |
| 139 | proj *graphql.AppSummaryFragment, |
| 140 | ) error { |
| 141 | ce.Infoln("Getting secrets list from Nhost...") |
| 142 | |
| 143 | cl, err := ce.GetNhostClient(ctx) |
| 144 | if err != nil { |
| 145 | return fmt.Errorf("failed to get nhost client: %w", err) |
| 146 | } |
| 147 | |
| 148 | resp, err := cl.GetSecrets( |
| 149 | ctx, |
| 150 | proj.ID, |
| 151 | ) |
| 152 | if err != nil { |
| 153 | return fmt.Errorf("failed to get secrets: %w", err) |
| 154 | } |
| 155 | |
| 156 | secrets := respToSecrets(resp.GetAppSecrets(), true) |
| 157 | if err := clienv.MarshalFile(&secrets, ce.Path.Secrets(), env.Marshal); err != nil { |
| 158 | return fmt.Errorf("failed to save nhost.toml: %w", err) |
| 159 | } |
| 160 | |
| 161 | ce.Infoln("Adding .secrets to .gitignore...") |
| 162 | |
| 163 | if err := system.AddToGitignore("\n.secrets\n"); err != nil { |
| 164 | return fmt.Errorf("failed to add .secrets to .gitignore: %w", err) |
| 165 | } |
| 166 | |
| 167 | return nil |
| 168 | } |
| 169 | |
| 170 | func Pull( |
| 171 | ctx context.Context, |
no test coverage detected