Skip to content

Commit

Permalink
changed loading in _control a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
dougransom committed Dec 31, 2022
1 parent 7678953 commit d9ef89c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/natlinkcore/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def expand_path(input_path: str) -> str:

except ModuleNotFoundError:
pass
except Exception as e:
print(f"{__file__} Exception {e} ignored in expand_path{input_path}")

env_expanded = expandvars(input_path)
# print(f'env_expanded: "{env_expanded}", from envvar: "{input_path}"')
Expand Down
16 changes: 12 additions & 4 deletions src/natlinkcore/natlinkstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,14 @@
# # # natlinkmain = loader.NatlinkMain()

## setting up Logger and Config is needed, when running this for test:
Logger = logging.getLogger('natlink')
Config = config.NatlinkConfig.from_first_found_file(loader.config_locations())
natlinkmain = loader.NatlinkMain(Logger, Config)
#Logger = logging.getLogger('natlink')

print(f"Warning code commented out by Doug Dec 31, 2022")
#_config_locations = loader.config_locations()
#Logger.debug(f"{__file__} Configugure {_config_locations}")
#Config = config.NatlinkConfig.from_first_found_file(_config_locations)
#Logger.debug(f"{__file__} Config {Config}")
#natlinkmain = loader.NatlinkMain(Logger, Config)

# the possible languages (for get_language), now in loader

Expand Down Expand Up @@ -142,7 +147,10 @@ class NatlinkStatus(metaclass=singleton.Singleton):
def __init__(self):
"""initialise all instance variables, in this singleton class, (only one instance)
"""
self.natlinkmain = natlinkmain # global
Logger = logging.getLogger('natlink')
_config_locations = loader.config_locations()
Config = config.NatlinkConfig.from_first_found_file(_config_locations)
self.natlinkmain = loader.NatlinkMain(Logger,Config)
self.DNSVersion = None
self.DNSIniDir = None
self.NatlinkDirectory = None
Expand Down

2 comments on commit d9ef89c

@quintijn
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doug, looks great. Is it an improvement when tweaking the config when testing?

@dougransom
Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes, it help me diagnose a problem too because things were starting too soon. I thought it was ok so I'll close this.

Please sign in to comment.