Skip to content

Unify data entry into the app #92

@oubiwann

Description

@oubiwann

Right now there are several points of entry for data:

  • Config
  • CLI flags
  • Environment variables
  • Constants
  • Clap defaults
  • Module-level defaults

The logic around that data is spread out and needs to be unified. Some include:

  • general util functions
  • App methods
  • DB methods
  • Clap matching/extracting functions

Features/tasks:

  • Create a new input module and gather existing input-specific modules in it (including config stuff)
  • Identify all current use of config in rucksack-lib (checking for possible cyclic deps) and move to input module
  • Establish order of precedence for ENV vars, config file values, CLI options, module-level defaults, etc.
  • Ensure (with tests) that ENV vars for all CLI flags work as expected, according to established order of precedence
  • Model input data
    • create a new input/model.rs module
    • move current config "schemas" here
    • add input model structs for all applicable CLI flags that currently do not have one
    • implement methods/utility functions for merging/unifying the various input data sources and populating the model structs
  • Remove all defaults from CLI options
  • Implement defaults in input module
  • For all applicable input model structs items that currently do not have CLI flags, create CLI flags
  • Update the entire app to ONLY use the input model for all data

The above changes have resulted in some bugs that popped up:

  • Fix issue with db files not being loaded because the CLI assumes a given command doesn't require DB access (this is true of very few commands, e.g., for rucksack gen)
  • Fix the issue where password history cannot be properly displayed in the CLI
  • Fix the issue of querying type any and category any don't actually match any of their respective fields

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions