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

Auto-generate edgee.toml Config File on First Launch #47

Open
SachaMorard opened this issue Sep 10, 2024 · 1 comment
Open

Auto-generate edgee.toml Config File on First Launch #47

SachaMorard opened this issue Sep 10, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@SachaMorard
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently, if a user launches ./edgee without an existing edgee.toml (or edgee.yaml) configuration file, the system exits without guidance. This can be confusing for new users. Instead, we should prompt the user to generate a default configuration file (edgee.toml), guiding them through the setup process interactively.

Proposed Solution

When ./edgee is launched and no configuration file is detected, the application should prompt the user with a series of questions, enabling them to easily set up their basic configuration. After gathering the necessary inputs, the system should auto-generate the edgee.toml file with the following structure:

[log]
level = "info"

[http]
address = "0.0.0.0:80"
force_https = false

[https]
address = "0.0.0.0:443"
cert = "certs/fullchain.pem"
key = "certs/privkey.pem"

[[routing]]
domain = "demo.edgee.dev"

[[routing.backends]]
name = "demo"
default = true
address = "demo-edgee.vercel.app"
enable_ssl = true

Requirements:

  • Interactive Prompt: When no config file exists, ./edgee should prompt the user with questions for each key in the configuration (e.g., log level, http address, etc.). Default values should be provided, with an option to skip or accept defaults.

  • Modular Design: The prompt system should be flexible and easily extendable, allowing for additional questions or configuration nodes to be added in the future without requiring major refactoring.

  • Rust Compatibility: The implementation should be in Rust and follow best practices for CLI interactivity and file generation. Consider using libraries like dialoguer for prompt handling and toml-rs for generating the configuration file.

  • Error Handling: Handle cases where users input invalid values (e.g., incorrect IP address formats) with clear error messages and an option to re-enter valid input.

Benefits:

  • Improved user experience for first-time users.
  • Simplifies the initial setup process, reducing the barrier to entry for those new to Edgee.
  • Provides a foundation for future configuration options to be added easily.

Additional Context:

This prompt-based config generation will ensure that users can get started quickly and will be especially useful for those unfamiliar with Edgee’s configuration syntax. The system should also create the config file in the current directory where ./edgee is launched.

@SachaMorard SachaMorard added the enhancement New feature or request label Sep 10, 2024
@SachaMorard SachaMorard added the repo/edgee label Sep 11, 2024 — with Linear
@spantheslayer
Copy link
Contributor

Hi @SachaMorard , I started working on this issue.

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

No branches or pull requests

3 participants