DeploySatelliteConfig deploys the satellite configuration
()
| 27 | |
| 28 | // DeploySatelliteConfig deploys the satellite configuration |
| 29 | func (d *Deployer) DeploySatelliteConfig() error { |
| 30 | log.Println("Deploying satellite configuration") |
| 31 | // Create a directory for the satellite configuration |
| 32 | dir, err := os.MkdirTemp("", "satellite-config-") |
| 33 | if err != nil { |
| 34 | return err |
| 35 | } |
| 36 | defer os.RemoveAll(dir) |
| 37 | |
| 38 | // Create a file for the satellite configuration |
| 39 | file, err := os.Create(filepath.Join(dir, "satellite.config")) |
| 40 | if err != nil { |
| 41 | return err |
| 42 | } |
| 43 | defer file.Close() |
| 44 | |
| 45 | // Write the satellite configuration to the file |
| 46 | _, err = file.WriteString(fmt.Sprintf("id=%s\n", d.satelliteConfig.id)) |
| 47 | if err != nil { |
| 48 | return err |
| 49 | } |
| 50 | |
| 51 | // Write the ground stations to the file |
| 52 | for _, groundStation := range d.satelliteConfig.groundStations { |
| 53 | _, err = file.WriteString(fmt.Sprintf("ground_station=%s\n", groundStation.id)) |
| 54 | if err != nil { |
| 55 | return err |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // Write the transceivers to the file |
| 60 | for _, transceiver := range d.satelliteConfig.transceivers { |
| 61 | _, err = file.WriteString(fmt.Sprintf("transceiver=%s\n", transceiver.id)) |
| 62 | if err != nil { |
| 63 | return err |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return nil |
| 68 | } |
| 69 | |
| 70 | // DeployNodeConfig deploys the node configuration |
| 71 | func (d *Deployer) DeployNodeConfig() error { |