Check if space track and n2yo creds are present, else prompt the user to enter them

This commit is contained in:
Christopher Woodall
2023-05-14 17:44:59 -05:00
parent c1f3ee10b9
commit e721dcfada
2 changed files with 33 additions and 7 deletions

34
main.go
View File

@@ -1,17 +1,43 @@
/*
Copyright © 2023 NAME HERE <EMAIL ADDRESS>
Copyright © 2023 Angelina Tsuboi angelinatsuboi@proton.me
*/
package main
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/ANG13T/SatIntel/cli"
)
func set_environmental_variable(env_key string) {
reader := bufio.NewReader(os.Stdin)
fmt.Print(env_key + ": ")
input, err := reader.ReadString('\n')
if err != nil {
fmt.Println("Error reading input:", err)
os.Exit(1)
}
os.Setenv(env_key, strings.TrimSpace(input))
}
func check_environmental_variable(env_key string) {
if os.Getenv(env_key) == "" {
set_environmental_variable(env_key)
}
}
func main() {
os.Setenv("SPACE_TRACK_USERNAME", "username")
os.Setenv("SPACE_TRACK_PASSWORD", "password")
os.Setenv("N2YO_API_KEY", "api-key")
check_environmental_variable("SPACE_TRACK_USERNAME")
check_environmental_variable("SPACE_TRACK_PASSWORD")
check_environmental_variable("N2YO_API_KEY")
cli.SatIntel()
}

View File

@@ -3,10 +3,10 @@ package osint
import (
"io/ioutil"
"fmt"
"github.com/iskaa02/qalam/gradient"
"github.com/iskaa02/qalam/gradient"
"encoding/json"
"github.com/TwiN/go-color"
"net/http"
"net/http"
"strconv"
"os"
)
@@ -31,7 +31,7 @@ func SatellitePositionVisualization() {
var norad string
fmt.Scanln(&norad)
GetLocation(norad)
}
}
return
}