Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7a8569f
rearrange dev deps (and unlock some) so the toml is valid
MoralCode Oct 23, 2025
23adc08
only test on current python
MoralCode Nov 5, 2025
bde4013
embed tox ini in pyproject.toml
MoralCode Nov 5, 2025
11d2332
use tox4
MoralCode Nov 5, 2025
e614b74
use tox4 with uv plugin
MoralCode Oct 23, 2025
28137e3
add pagination offset to config dict per TODO comment
MoralCode Nov 3, 2025
77a8012
create a ConfigStore class to act as an interface for many possible c…
MoralCode Nov 3, 2025
ab23de4
implement the config store for json data
MoralCode Nov 3, 2025
3d98bfa
add test case for some jsonconfig stuff
MoralCode Nov 5, 2025
74d917d
Merge branch 'unit-testing' into config/hierarchy
MoralCode Nov 10, 2025
8118447
set up tox to run the new tests
MoralCode Nov 5, 2025
8e0c979
set up loggers in the ConfigStore classes
MoralCode Nov 5, 2025
755642a
Add DatabaseConfig implementation of ConfigStore to handle config sto…
MoralCode Nov 5, 2025
829cda4
set up config hierarchy
MoralCode Nov 5, 2025
5d57910
determine emptiness based on all sources
MoralCode Nov 5, 2025
4f04826
get dict form of config based on all sources
MoralCode Nov 5, 2025
ea01040
determine if section is present in AugurConfig based on all sources
MoralCode Nov 5, 2025
c60fcab
handle simpler cases where the writeable source needs to be updated
MoralCode Nov 5, 2025
ac479c0
update value redaction for API key values
MoralCode Nov 5, 2025
e2056e2
testing fixes
MoralCode Nov 6, 2025
7754077
implement add_section_from_json using new config classes
MoralCode Nov 6, 2025
10b38d5
factor out a helper for filtering the config sources
MoralCode Nov 6, 2025
23a25df
add a base-config property to return the config as assembled by all r…
MoralCode Nov 6, 2025
16ea9fa
adjust config init process to use the new base_config
MoralCode Nov 6, 2025
3960551
unused function
MoralCode Nov 6, 2025
bb7ae02
pass in a mock logger as part of the JsonConfig tests
MoralCode Nov 6, 2025
220aa0f
don't use an in-place reverse - its going to cause all sorts of issues
MoralCode Nov 6, 2025
3884fa8
use a function that exists
MoralCode Nov 6, 2025
30e8e82
add a test case for fetching real values
MoralCode Nov 6, 2025
05812c2
fix unhashable type
MoralCode Nov 6, 2025
53a2ae3
refactor redaction into a helper
MoralCode Nov 6, 2025
2d4fa30
add_or_update_settings is used externally, replace it with a call to …
MoralCode Nov 6, 2025
9c1f422
replace external calls to add_or_update_settings
MoralCode Nov 6, 2025
aa6ce9d
make use of redaction function
MoralCode Nov 6, 2025
de98f25
fix: extract intended dict value from the returned list
MoralCode Nov 6, 2025
9d19d48
more fixes
MoralCode Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 13 additions & 31 deletions augur/application/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from augur.application.db.models import Config
from augur.application.db.session import DatabaseSession
from augur.application.config import AugurConfig
from augur.application.config import AugurConfig, redact_setting_value
from augur.application.cli import DatabaseContext, test_connection, test_db_connection, with_database
from augur.util.inspect_without_import import get_phase_names_without_import
ROOT_AUGUR_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
Expand Down Expand Up @@ -50,7 +50,7 @@

facade_repo_directory = str(input("Please enter an existing facade repo directory: ")).strip()

if os.path.isdir(facade_repo_directory):

Check warning on line 53 in augur/application/cli/config.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 R1723: Unnecessary "else" after "break", remove the "else" and de-indent the code inside it (no-else-break) Raw Output: augur/application/cli/config.py:53:12: R1723: Unnecessary "else" after "break", remove the "else" and de-indent the code inside it (no-else-break)
break
else:
print("Invalid directory")
Expand All @@ -68,15 +68,15 @@

config = AugurConfig(logger, session)

default_config = config.default_config
augmented_config = config.base_config

phase_names = get_phase_names_without_import()

#Add all phases as enabled by default
for name in phase_names:

if name not in default_config['Task_Routine']:
default_config['Task_Routine'].update({name : 1})
if name not in augmented_config['Task_Routine']:
augmented_config['Task_Routine'].update({name : 1})

#print(default_config)
if redis_conn_string:
Expand All @@ -91,18 +91,18 @@
except ValueError:
pass

default_config["Redis"]["connection_string"] = redis_conn_string
augmented_config["Redis"]["connection_string"] = redis_conn_string

if rabbitmq_conn_string:
default_config["RabbitMQ"]["connection_string"] = rabbitmq_conn_string
augmented_config["RabbitMQ"]["connection_string"] = rabbitmq_conn_string

default_config["Keys"] = keys
augmented_config["Keys"] = keys

default_config["Facade"]["repo_directory"] = facade_repo_directory
augmented_config["Facade"]["repo_directory"] = facade_repo_directory

default_config["Logging"]["logs_directory"] = logs_directory or (ROOT_AUGUR_DIRECTORY + "/logs/")
augmented_config["Logging"]["logs_directory"] = logs_directory or (ROOT_AUGUR_DIRECTORY + "/logs/")

config.load_config_from_dict(default_config)
config.load_config_from_dict(augmented_config)


@cli.command('load')
Expand Down Expand Up @@ -162,35 +162,17 @@
@click.option('--section', required=True)
@click.option('--setting', required=True)
@click.option('--value', required=True)
@click.option('--data-type')
@test_connection
@test_db_connection
@with_database
@click.pass_context
def config_set(ctx, section, setting, value, data_type):
def config_set(ctx, section, setting, value):

with DatabaseSession(logger, engine=ctx.obj.engine) as session:
config = AugurConfig(logger, session)

if not data_type:
result = session.query(Config).filter(Config.section_name == section, Config.setting_name == setting).all()
if not result:
return click.echo("You must specify a data-type if the setting does not already exist")
data_type = result[0].type

if data_type not in config.accepted_types:
print(f"Error invalid type for config. Please use one of these types: {config.accepted_types}")
return

setting_dict = {
"section_name": section,
"setting_name": setting,
"value": value,
"type": data_type
}

config.add_or_update_settings([setting_dict])
print(f"{setting} in {section} section set to {value}")
config.add_value(section, setting, value)
print(f"{setting} in {section} section set to {redact_setting_value(section, setting, value)}")

@cli.command('get')
@click.option('--section', required=True)
Expand Down
Loading
Loading