Skip to content

Commit

Permalink
Add: view configs, Update: menu
Browse files Browse the repository at this point in the history
  • Loading branch information
aaanh committed Apr 20, 2024
1 parent a87cc7b commit 671ee02
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
19 changes: 15 additions & 4 deletions app/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,23 @@ func updateStates(config *structs.Config) {
}
}

func dryRun(config structs.Config) any {
fmt.Printf("\n\nPerforming dry run and display what-if results.\n\n")
fmt.Printf("\n\nCurrently under development.\n\n")
return nil
func viewCurrentConfigs(cfg *structs.Config) {
fmt.Printf("\n\n")
fmt.Println("=== Configurations and Keys ===")
fmt.Println("- Tailscale API key: ", cfg.Keys.TailscaleApiKey)
fmt.Println("- Tailnet Organization: ", cfg.TailnetOrg)
fmt.Println("- Cloudflare API key: ", cfg.Keys.CloudflareApiKey)
fmt.Println("- Cloudflare Zone ID (domain ID): ", cfg.CloudflareZoneId)
fmt.Printf("\n\n")
}

// TODO: To be implemented
// func dryRun(config structs.Config) any {
// fmt.Printf("\n\nPerforming dry run and display what-if results.\n\n")
// fmt.Printf("\n\nCurrently under development.\n\n")
// return nil
// }

func performSync(config *structs.Config) {
cf.CheckCloudflareToken(config)
cf.AddCloudflareDnsRecords(config, ts.GetTailscaleDevices(config))
Expand Down
2 changes: 1 addition & 1 deletion app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func choiceHandler(choice int, config *structs.Config) {
case 6:
cf.DeleteAddedDnsRecords(config)
case 7:
dryRun(*config)
viewCurrentConfigs(config)
case 8:
{
fmt.Println("\n=== Thanks for using Tailflare :> ===")
Expand Down
4 changes: 2 additions & 2 deletions app/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func Menu(cfg *structs.Config) int {
}
}()),
5: "Perform Sync",
6: "Delete added records",
7: "Dry run (What-If)",
6: "Delete synced records",
7: "View configurations and keys",
8: "Exit",
}

Expand Down
2 changes: 1 addition & 1 deletion config.cfg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version="0.0.1"
version="0.0.2"

0 comments on commit 671ee02

Please sign in to comment.