Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Michael's password from default config file #52

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions src/fibad/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import toml

DEFAULT_CONFIG_FILEPATH = Path(__file__).parent.resolve() / "fibad_default_config.toml"
DEFAULT_USER_CONFIG_FILEPATH = Path.cwd() / "fibad_config.toml"


def get_runtime_config(
Expand Down Expand Up @@ -38,6 +39,10 @@
with open(default_config_filepath, "r") as f:
default_runtime_config = toml.load(f)

# If a named config exists in cwd, and no config specified on cmdline, use cwd.
if runtime_config_filepath is None and DEFAULT_USER_CONFIG_FILEPATH.exists():
runtime_config_filepath = DEFAULT_USER_CONFIG_FILEPATH

Check warning on line 44 in src/fibad/config_utils.py

View check run for this annotation

Codecov / codecov/patch

src/fibad/config_utils.py#L44

Added line #L44 was not covered by tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that this is meant to be a convenience so that you don't have to pass in a user config, yeah? If that's the case, I can understand where you're coming from.

However, it also feels like it might open a door for unintended settings. i.e. A user has a fibad_config.toml and a fibad_config2.toml, and fails to pass the config when they want to use the "2" version.

Maybe I'm misinterpreting the utility here though. Let me know if I'm missing a broader point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's not a broader point to this part beyond the convenience of not passing --runtime-config or config= every time.


if runtime_config_filepath is not None:
if not runtime_config_filepath.exists():
raise FileNotFoundError(f"Runtime configuration file not found: {runtime_config_filepath}")
Expand Down
6 changes: 2 additions & 4 deletions src/fibad/fibad_default_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ sh = "22asec"
filter = ["HSC-G", "HSC-R", "HSC-I", "HSC-Z", "HSC-Y"]
type = "coadd"
rerun = "pdr3_wide"
username = "mtauraso@local"
password = "cCw+nX53lmNLHMy+JbizpH/dl4t7sxljiNm6a7k1"
max_connections = 2
fits_file = "../hscplay/temp.fits"
cutout_dir = "../hscplay/cutouts/"
fits_file = "./catalog.fits"
cutout_dir = "./data"
offset = 0
num_sources = 500

Expand Down