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

add configuration of hostname and port #9

Open
wants to merge 2 commits into
base: isochrone
Choose a base branch
from

Conversation

oweno-tfwm
Copy link

add configuration of hostname and port so that it works in corporate IT environment that block use of 'localhost'

@hulsiejames hulsiejames self-requested a review August 25, 2023 10:40
@@ -90,7 +90,7 @@ def report_time():
"Calculating costs for %s - %s", time_period.name, ", ".join(modes)
)
cost_settings = cost.CostSettings(
server_url="http://localhost:8080",
server_url="http://" + config.hostname + ":" + str(config.port),
Copy link

@hulsiejames hulsiejames Aug 25, 2023

Choose a reason for hiding this comment

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

Have you considered any url validation?

What would occur if a config hostname of "http://my_hostname" was provided by mistake?

Copy link

@hulsiejames hulsiejames left a comment

Choose a reason for hiding this comment

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

A great PR, thank you @oweno-tfwm

Jut a small thought on url validation!

Cheers

@oweno-tfwm
Copy link
Author

oweno-tfwm commented Aug 25, 2023 via email

@oweno-tfwm
Copy link
Author

I'll add some extra validation on this next time I'm touching the code - have been a bit busy the last few weeks to pick it up !

@hulsiejames
Copy link

No worries, I know the feeling @oweno-tfwm!

I have just created a separate PR that includes some Url validation with pydantic.networks.AnyHttpUrl & some custom validators when the config is read. Not too sure when you may get a chance to look at this again so want to get it in!

If no values are specified in the config then the default configuration is loaded ("loalhost:8080"). Otherwise, values in the config are used and validated with AnyHttpUrl

@oweno-tfwm
Copy link
Author

smashing - have a load of other changes in another fork that I've dropped you an email about (to the email address on your profile)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants