refactor: hardcode secret key in crypto package
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
|
||||
type Config struct {
|
||||
ArlCookie string `mapstructure:"arl_cookie"`
|
||||
SecretKey string `mapstructure:"secret_key"`
|
||||
OutputDir string `mapstructure:"output_dir"`
|
||||
HomeDir string
|
||||
}
|
||||
@@ -33,7 +32,7 @@ func New(cfgPath string) (*Config, error) {
|
||||
if _, err := os.Stat(cfgPath); os.IsNotExist(err) {
|
||||
fmt.Printf("Config file not found, creating one at %s\n", cfgPath)
|
||||
|
||||
content := []byte("arl_cookie = ''\nsecret_key = ''\noutput_dir = ''\n")
|
||||
content := []byte("arl_cookie = ''\noutput_dir = ''\n")
|
||||
if err := os.WriteFile(cfgPath, content, 0644); err != nil {
|
||||
return nil, fmt.Errorf("failed to create config file: %w", err)
|
||||
}
|
||||
@@ -68,12 +67,6 @@ func (c *Config) Validate() error {
|
||||
if c.ArlCookie == "" {
|
||||
return fmt.Errorf("arl_cookie is not set")
|
||||
}
|
||||
if c.SecretKey == "" {
|
||||
return fmt.Errorf("secret_key is not set")
|
||||
}
|
||||
if len(c.SecretKey) != 16 {
|
||||
return fmt.Errorf("secret_key must be 16 bytes long")
|
||||
}
|
||||
if c.OutputDir == "" {
|
||||
c.OutputDir = filepath.Join(c.HomeDir, "Music", "GoDeez")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user