-
Notifications
You must be signed in to change notification settings - Fork 65
/
main.go
50 lines (38 loc) · 914 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Copyright © 2023 Angelina Tsuboi [email protected]
*/
package main
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/ANG13T/SatIntel/cli"
)
func setEnvironmentalVariable(envKey string) string {
reader := bufio.NewReader(os.Stdin)
fmt.Printf("%s: ", envKey)
input, err := reader.ReadString('\n')
if err != nil {
fmt.Println("Error reading input:", err)
os.Exit(1)
}
input = strings.TrimSuffix(input, "\n")
if err := os.Setenv(envKey, input); err != nil {
fmt.Printf("Error setting environment variable %s: %v\n", envKey, err)
os.Exit(1)
}
return input
}
func checkEnvironmentalVariable(envKey string) {
_, found := os.LookupEnv(envKey)
if !found {
setEnvironmentalVariable(envKey)
}
}
func main() {
checkEnvironmentalVariable("SPACE_TRACK_USERNAME")
checkEnvironmentalVariable("SPACE_TRACK_PASSWORD")
checkEnvironmentalVariable("N2YO_API_KEY")
cli.SatIntel()
}