Skip to content

Commit

Permalink
Show correct URL based on env
Browse files Browse the repository at this point in the history
  • Loading branch information
vsalvino committed Oct 19, 2022
1 parent fe792f9 commit b65a14d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 8 additions & 0 deletions cr/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ def __init__(self, handle: str, token: str):
db_type=DatabaseType(dbdict["db_type"]),
)

def url(self, env: Env) -> str:
"""
Return the URL of this website based on environment.
"""
if env == Env.STAGING:
return f"https://{self.handle}.staging.codered.cloud/"
return self.primary_url

def local_check_path(self, p: Path, c: Optional[Console]) -> None:
"""
Validity check for a provided Path ``p``. If Console ``c`` is provided,
Expand Down
7 changes: 3 additions & 4 deletions cr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def run(self, args: argparse.Namespace):
)
pbar.update(t, total=1, completed=1)

CONSOLE.print(f"\nYour site is live at: {w.primary_url}\n")
CONSOLE.print(f"\nYour site is live at: {w.url(args.env)}\n")


class Restart(Command):
Expand All @@ -332,9 +332,8 @@ def run(self, args: argparse.Namespace):
w = self.get_webapp(args)
w.api_queue_restart(args.env)
CONSOLE.print(
"Restart in progress. You will receive an email when complete."
"\n\n"
f"Restarting: {w.primary_url}"
f"Restarting: {w.url(args.env)}\n"
"You will receive an email when complete."
)


Expand Down

0 comments on commit b65a14d

Please sign in to comment.