You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: added functionality to create yaml config file and preliminary pull command
Signed-off-by: Jason Salaber <[email protected]>
feat: added prompts for default values if not defined
Signed-off-by: Jason Salaber <[email protected]>
chore: conditionally add auth header if auth token is not empty
Signed-off-by: Jason Salaber <[email protected]>
chore: added tests for pull command
Signed-off-by: Jason Salaber <[email protected]>
feat: added ability to pull from local file for source flags
Signed-off-by: Jason Salaber <[email protected]>
chore: refactor of pull command
Signed-off-by: Kris Coleman <[email protected]>
* refactor(pull): improves default value prompting
Refactors the default value prompting logic for flags to handle errors more gracefully.
The changes improve error handling and ensure that the user is prompted again if an invalid input is provided. Also ensures object types cannot be prompted for as they should be defined in code.
Signed-off-by: Kris Coleman <[email protected]>
* refactor(init): streamlines config file creation logic
Consolidates the conditional logic for creating or updating the
.openfeature.yaml file. This change improves readability and
reduces code duplication by using a flag to determine whether
the config file should be written.
Signed-off-by: Kris Coleman <[email protected]>
* refactor(manifest): improves remote flag loading
Refactors remote flag loading to handle errors more gracefully.
This change ensures that the function returns nil immediately upon
encountering an error, preventing potential issues with uninitialized
flagsets. Additionally, initializes the flagset object only when
standard manifest parsing is attempted. It then returns the flagset
with source flags upon successful parsing.
Signed-off-by: Kris Coleman <[email protected]>
* refactor: uses generic prompt for input validation
Refactors the prompt logic for integer and float default
values to use a new generic function.
This improves code reusability and reduces duplication by
centralizing the input validation logic.
Signed-off-by: Kris Coleman <[email protected]>
* refactor: improves prompt readability
Moves the prompt definition outside the switch statement to avoid
repetition and improves code readability.
Signed-off-by: Kris Coleman <[email protected]>
* refactors init command for clarity
Refactors the init command to improve readability and maintainability.
Moves logic for manifest creation and config file handling into
separate functions for better organization.
Introduces a confirmOverride function to reduce duplication and
improve user experience when overriding existing files.
Signed-off-by: Kris Coleman <[email protected]>
* fix: handles errors during confirmation prompts
This commit improves error handling in the init command.
It addresses the issue where errors during confirmation prompts
were not being properly handled, leading to unexpected behavior.
Now, the application gracefully handles errors that may arise during
the confirmation prompt, providing a more robust user experience.
Signed-off-by: Kris Coleman <[email protected]>
* refactor(init): uses template for config file
Refactors the way the default configuration file is generated.
Instead of using string concatenation, it uses a template to
generate the configuration file. This makes the configuration
file more readable and easier to maintain and allows to handle
conditional content.
Signed-off-by: Kris Coleman <[email protected]>
* feat: adds json marshalling for flagset
Adds the ability to marshal a Flagset into JSON format, making
it compatible with the expected manifest structure. Also updates
the write function to use the new marshalling logic to properly
format the flags in the manifest file.
Signed-off-by: Kris Coleman <[email protected]>
* refactor: improves manifest creation and writing
Refactors manifest creation and writing logic into separate, reusable functions.
This improves code readability and reduces duplication by extracting the
manifest creation and writing processes into dedicated functions. This
allows for more consistent handling of manifest operations across different
parts of the codebase.
Signed-off-by: Kris Coleman <[email protected]>
* refactor(manifest): uses afero filesystem for file access
Uses the abstract afero filesystem to read the flags file.
This change improves testability and allows for easier
manipulation of the filesystem in different environments.
Signed-off-by: Kris Coleman <[email protected]>
* fix: writes manifest file atomically
Ensures that the manifest file is written to disk atomically.
This prevents potential data corruption or incomplete writes
if the process is interrupted during the write operation.
This implementation writes the manifest to a temporary file,
then renames it to the target path, guaranteeing atomicity.
Signed-off-by: Kris Coleman <[email protected]>
* refactor: moves prompt functions to the bottom
Moves the promptWithValidation and promptForDefaultValue
functions to the bottom of the file. This improves code
organization and readability by grouping related
functionality together.
Signed-off-by: Kris Coleman <[email protected]>
* fix: uses pointer for flags to handle defaults
Fixes a bug where flag default values were not being correctly
handled when prompting the user for input. This commit updates
the code to use a pointer to the flag, ensuring that the
default value is correctly assigned after prompting.
Signed-off-by: Kris Coleman <[email protected]>
* fix: corrects json unmarshaling error handling
Updates the error handling when unmarshaling JSON to provide a
more accurate error message.
Refactors the flagset writing process to directly process flag data,
avoiding intermediate marshaling and unmarshaling steps. This
simplifies the code and improves efficiency.
Signed-off-by: Kris Coleman <[email protected]>
* refactor(pull): improves url handling for flag sources
Refactors the flag source URL handling to use the `net/url` package.
This change improves the robustness and clarity of the code by
utilizing the `net/url` package to parse and validate the flag source
URL. It now supports `file`, `http`, and `https` schemes.
Signed-off-by: Kris Coleman <[email protected]>
* fix(manifest): handles fs.remove errors gracefully
Ensures that errors during temporary file removal are handled
gracefully, preventing potential resource leaks or incomplete
operations.
It prioritizes the original error during manifest writing/renaming
and logs the removal error to avoid masking the initial issue.
Signed-off-by: Kris Coleman <[email protected]>
* wip: lint fixes
Signed-off-by: Kris Coleman <[email protected]>
---------
Signed-off-by: Kris Coleman <[email protected]>
Co-authored-by: Jason Salaber <[email protected]>
Co-authored-by: Michael Beemer <[email protected]>
0 commit comments