Skip to content

Commit 17ed6b3

Browse files
committed
revert config changes
1 parent 910bac2 commit 17ed6b3

File tree

10 files changed

+1
-195
lines changed

10 files changed

+1
-195
lines changed

Diff for: config/config-default.ini

-10
This file was deleted.

Diff for: config/config.go

+1-44
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func GetDefaultHomeDir() *paths.Path {
108108
return paths.New(homeDir)
109109
}
110110

111-
//go:embed config-default.ini
111+
//go:embed config.ini
112112
var configContent []byte
113113

114114
// GenerateConfig function will take a directory path as an input
@@ -142,46 +142,3 @@ func SetInstallCertsIni(filename string, value string) error {
142142
}
143143
return nil
144144
}
145-
146-
// GetConfigPath returns the full path to the Arduino Create Agent configuration file.
147-
// It will check if the config file exists in the default location
148-
// and if not, it will generate a new one.
149-
// It will also check if the ARDUINO_CREATE_AGENT_CONFIG environment variable is set,
150-
// and if so, it will use that path instead of the default one.
151-
func GetConfigPath() *paths.Path {
152-
// Let's handle the config
153-
configDir := GetDefaultConfigDir()
154-
var configPath *paths.Path
155-
156-
// see if the env var is defined, if it is take the config from there, this will override the default path
157-
if envConfig := os.Getenv("ARDUINO_CREATE_AGENT_CONFIG"); envConfig != "" {
158-
configPath = paths.New(envConfig)
159-
if configPath.NotExist() {
160-
log.Panicf("config from env var %s does not exists", envConfig)
161-
}
162-
log.Infof("using config from env variable: %s", configPath)
163-
} else if defaultConfigPath := configDir.Join("config.ini"); defaultConfigPath.Exist() {
164-
// by default take the config from the ~/.arduino-create/config.ini file
165-
configPath = defaultConfigPath
166-
log.Infof("using config from default: %s", configPath)
167-
} else {
168-
// Fall back to the old config.ini location
169-
src, _ := os.Executable()
170-
oldConfigPath := paths.New(src).Parent().Join("config.ini")
171-
if oldConfigPath.Exist() {
172-
err := oldConfigPath.CopyTo(defaultConfigPath)
173-
if err != nil {
174-
log.Errorf("cannot copy old %s, to %s, generating new config", oldConfigPath, configPath)
175-
} else {
176-
configPath = defaultConfigPath
177-
log.Infof("copied old %s, to %s", oldConfigPath, configPath)
178-
}
179-
}
180-
}
181-
if configPath == nil {
182-
configPath = GenerateConfig(configDir)
183-
}
184-
185-
return configPath
186-
187-
}

Diff for: config/config_test.go

-94
This file was deleted.

Diff for: config/testdata/fromdefault/.gitignore

-1
This file was deleted.

Diff for: config/testdata/fromenv/config.ini

-8
This file was deleted.

Diff for: config/testdata/fromhome/.config/ArduinoCreateAgent/config.ini

-8
This file was deleted.

Diff for: config/testdata/fromlegacy/.gitignore

-2
This file was deleted.

Diff for: config/testdata/fromxdghome/ArduinoCreateAgent/config.ini

-10
This file was deleted.

Diff for: config/testdata/home/.config/ArduinoCreateAgent/config.ini

-8
This file was deleted.

Diff for: config/testdata/noconfig/.config/ArduinoCreateAgent/config.ini

-10
This file was deleted.

0 commit comments

Comments
 (0)