mirror of
https://github.com/railwayapp/cli
synced 2026-04-21 14:07:23 +00:00
31 lines
515 B
Go
31 lines
515 B
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/railwayapp/cli/entity"
|
|
)
|
|
|
|
func (h *Handler) Protect(ctx context.Context, req *entity.CommandRequest) error {
|
|
projectConfigs, err := h.ctrl.GetProjectConfigs(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
mp := make(map[string]bool)
|
|
|
|
for k, v := range projectConfigs.LockedEnvsNames {
|
|
mp[k] = v
|
|
}
|
|
|
|
mp[projectConfigs.Environment] = true
|
|
|
|
projectConfigs.LockedEnvsNames = mp
|
|
|
|
err = h.cfg.SetProjectConfigs(projectConfigs)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return err
|
|
}
|