-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add redis seed * - fix typos * support set hashed and non hashed entries * - remote redundant use of seconds time unit - change method to private * rename struct fields * Change seed data structure * update changelog * Update CHANGELOG.md --------- Co-authored-by: avivpxi <[email protected]>
- Loading branch information
Showing
7 changed files
with
288 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2024 HUMAN Security. | ||
// Use of this source code is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"github.com/perimeterx/envite" | ||
"github.com/perimeterx/envite/seed/redis" | ||
) | ||
|
||
// buildRedisSeed is a builder function that constructs a new Redis seed component. | ||
// It takes a byte slice of JSON data as input. | ||
// The function attempts to parse the JSON data into a redis.SeedConfig struct, which defines the configuration | ||
// for a Redis seed component. If the JSON data is successfully parsed, it then uses this configuration | ||
// to instantiate and return a new Redis seed component via the redis.NewSeedComponent function. | ||
// | ||
// Returns: | ||
// - An envite.Component which is the redis.SeedComponent initialized with the provided configuration. | ||
// - An error if the JSON data cannot be parsed into a redis.SeedConfig struct. | ||
func buildRedisSeed(data []byte, _ flagValues, _ string) (envite.Component, error) { | ||
var config redis.SeedConfig | ||
err := json.Unmarshal(data, &config) | ||
if err != nil { | ||
return nil, fmt.Errorf("could not parse config: %w", err) | ||
} | ||
|
||
return redis.NewSeedComponent(config), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.