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

refactor(main): change config to envs #3121

Merged
merged 1 commit into from
May 24, 2023
Merged

Conversation

cuisongliu
Copy link
Collaborator

@cuisongliu cuisongliu commented May 24, 2023

🤖 Generated by Copilot at 5a79e77

Summary

♻️✨🔥

Renamed the config package and command to env to better reflect its functionality of displaying and setting environment variables for sealos. Simplified the code and the output of the env command. Removed unused and redundant code related to configuration options.

Sing, O Muse, of the skillful sealos team, who changed their code with wisdom and care
They renamed the config package and command to env, to show the variables of their software's lair
They added a new cobra.Command for the env subcommand, with a long description clear and fair
They removed the redundant and unused code, and simplified the ConfigOption struct, like a sculptor of marble rare

Walkthrough

  • Rename config package and command to env to display and set environment variables for sealos (link, link, link, link)
  • Remove Set function and setValue method from env package as they are no longer needed (link, link)
  • Simplify ConfigOption struct by removing AllowedValues and OSEnv fields and use constants for environment variable names (link, link, link)
  • Delete pkg/system/config_cmd.go file as it is replaced by pkg/system/env_cmd.go (link)
  • Update NewExampleConfig function in pkg/system/env_example.go to generate a simpler template string for the env command long description (link)
  • Update tests in pkg/system/env_example_test.go to match the new template string (link)

@codecov
Copy link

codecov bot commented May 24, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (2a83f67) 72.97% compared to head (51241ef) 72.97%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3121   +/-   ##
=======================================
  Coverage   72.97%   72.97%           
=======================================
  Files           8        8           
  Lines         618      618           
=======================================
  Hits          451      451           
  Misses        132      132           
  Partials       35       35           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

RuntimeRootConfigKey = "SEALOS_RUNTIME_ROOT"
DataRootConfigKey = "SEALOS_DATA_ROOT"
BuildahFormatConfigKey = "BUILDAH_FORMAT"
ScpChecksumConfigKey = "SEALOS_SCP_CHECKSUM"
)

func (*envSystemConfig) getValueOrDefault(key string) (string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if option.OSEnv == "" {
        option.OSEnv = strings.ReplaceAll(strings.ToUpper(constants.AppName+"_"+option.Key), "-", "_")
}

Signed-off-by: cuisongliu <cuisongliu@qq.com>
@cuisongliu cuisongliu merged commit 857a238 into labring:main May 24, 2023
54 checks passed
@cuisongliu cuisongliu deleted the envs branch May 24, 2023 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants