Skip to content

Commit

Permalink
Integrating PR #1803
Browse files Browse the repository at this point in the history
  • Loading branch information
costrouc committed Jun 21, 2023
1 parent a281f5b commit 2f909e3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
7 changes: 3 additions & 4 deletions src/_nebari/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

def render_config(
project_name: str,
nebari_domain: str,
nebari_domain: str = None,
cloud_provider: schema.ProviderEnum = schema.ProviderEnum.local,
ci_provider: schema.CiEnum = schema.CiEnum.none,
repository: str = None,
Expand All @@ -42,9 +42,8 @@ def render_config(
project_name = input("Provide project name: ")
config["project_name"] = project_name

if nebari_domain is None and not disable_prompt:
nebari_domain = input("Provide domain: ")
config["domain"] = nebari_domain
if nebari_domain is not None:
config["domain"] = nebari_domain

config["ci_cd"] = {"type": ci_provider.value}
config["terraform_state"] = {"type": terraform_state.value}
Expand Down
54 changes: 29 additions & 25 deletions src/_nebari/subcommands/init.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import pathlib
import re
import typing

import questionary
import rich
Expand Down Expand Up @@ -288,7 +289,7 @@ def init(
"-p",
callback=check_project_name,
),
domain_name: str = typer.Option(
domain_name: typing.Optional[str] = typer.Option(
...,
"--domain-name",
"--domain",
Expand Down Expand Up @@ -449,15 +450,17 @@ def guided_init_wizard(ctx: typer.Context, guided_init: str):
# DOMAIN NAME
rich.print(
(
"\n\n 🪴 Great! Now you need to provide a valid domain name (i.e. the URL) to access your Nebri instance. "
"This should be a domain that you own.\n\n"
"\n\n 🪴 Great! Now you can provide a valid domain name (i.e. the URL) to access your Nebri instance. "
"This should be a domain that you own. Default if unspecified is the IP of the load balancer.\n\n"
)
)
inputs.domain_name = questionary.text(
"What domain name would you like to use?",
qmark=qmark,
validate=lambda text: True if len(text) > 0 else "Please enter a value",
).unsafe_ask()
inputs.domain_name = (
questionary.text(
"What domain name would you like to use?",
qmark=qmark,
).unsafe_ask()
or None
)

# AUTH PROVIDER
rich.print(
Expand Down Expand Up @@ -553,27 +556,28 @@ def guided_init_wizard(ctx: typer.Context, guided_init: str):
inputs.ci_provider = CiEnum.gitlab_ci.value.lower()

# SSL CERTIFICATE
rich.print(
(
"\n\n 🪴 This next section is [italic]optional[/italic] but recommended. If you want your Nebari domain to use a Let's Encrypt SSL certificate, "
"all we need is an email address from you.\n\n"
if inputs.domain_name:
rich.print(
(
"\n\n 🪴 This next section is [italic]optional[/italic] but recommended. If you want your Nebari domain to use a Let's Encrypt SSL certificate, "
"all we need is an email address from you.\n\n"
)
)
)
ssl_cert = questionary.confirm(
"Would you like to add a Let's Encrypt SSL certificate to your domain?",
default=False,
qmark=qmark,
auto_enter=False,
).unsafe_ask()

if ssl_cert:
inputs.ssl_cert_email = questionary.text(
"Which email address should Let's Encrypt associate the certificate with?",
ssl_cert = questionary.confirm(
"Would you like to add a Let's Encrypt SSL certificate to your domain?",
default=False,
qmark=qmark,
auto_enter=False,
).unsafe_ask()

if not disable_checks:
check_ssl_cert_email(ctx, ssl_cert_email=inputs.ssl_cert_email)
if ssl_cert:
inputs.ssl_cert_email = questionary.text(
"Which email address should Let's Encrypt associate the certificate with?",
qmark=qmark,
).unsafe_ask()

if not disable_checks:
check_ssl_cert_email(ctx, ssl_cert_email=inputs.ssl_cert_email)

# ADVANCED FEATURES
rich.print(
Expand Down
2 changes: 1 addition & 1 deletion src/nebari/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ def project_name_convention(value: typing.Any, values):
class InitInputs(Base):
cloud_provider: ProviderEnum = ProviderEnum.local
project_name: str = ""
domain_name: str = ""
domain_name: typing.Optional[str] = None
namespace: typing.Optional[letter_dash_underscore_pydantic] = "dev"
auth_provider: AuthenticationEnum = AuthenticationEnum.password
auth_auto_provision: bool = False
Expand Down

0 comments on commit 2f909e3

Please sign in to comment.