| 1352 | } |
| 1353 | |
| 1354 | func (ws *WshServer) GetVarCommand(ctx context.Context, data wshrpc.CommandVarData) (*wshrpc.CommandVarResponseData, error) { |
| 1355 | _, fileData, err := filestore.WFS.ReadFile(ctx, data.ZoneId, data.FileName) |
| 1356 | if err == fs.ErrNotExist { |
| 1357 | return &wshrpc.CommandVarResponseData{Key: data.Key, Exists: false}, nil |
| 1358 | } |
| 1359 | if err != nil { |
| 1360 | return nil, fmt.Errorf("error reading blockfile: %w", err) |
| 1361 | } |
| 1362 | envMap := envutil.EnvToMap(string(fileData)) |
| 1363 | value, ok := envMap[data.Key] |
| 1364 | return &wshrpc.CommandVarResponseData{Key: data.Key, Exists: ok, Val: value}, nil |
| 1365 | } |
| 1366 | |
| 1367 | func (ws *WshServer) GetAllVarsCommand(ctx context.Context, data wshrpc.CommandVarData) ([]wshrpc.CommandVarResponseData, error) { |
| 1368 | _, fileData, err := filestore.WFS.ReadFile(ctx, data.ZoneId, data.FileName) |