shogo/internal/utils/read.go

21 lines
324 B
Go
Raw Normal View History

package utils
import "os"
// Return the API key
func getKey() (string, error) {
// Get config directory
config, err := os.UserConfigDir()
if err != nil {
return "", err
}
// Read the file
content, err := os.ReadFile(config + "/shodan/api_key")
if err != nil {
return "", err
}
return string(content), nil
}