Skip to content

Conversation

@ntozaks
Copy link
Contributor

@ntozaks ntozaks commented Jun 4, 2025

Adjusted the creation of the server file. Creates the file and reads the data using slices of string type. Prepends '#' to the CLI commands so they are comments.

Addresses issue: #53

err = os.WriteFile(c.configFileServer, []byte(peer.CreateServerFile(serverConfigRelay, serverConfigE2EE)), 0600)
file, err := os.Create(c.configFileServer)
if err != nil {
fmt.Printf("error creating server config file: %v", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error string should be saved to the fileStatusServer variable and formatted using the same RedBold() and Red() that the other errors use.

Also, if this error is triggered it should skip over the rest of this new code since the file.WriteString() call is going to fail if the file creation fails.


data := []string{
peer.CreateServerFile(serverConfigRelay, serverConfigE2EE),
peer.CreateServerCommand(serverConfigRelay, serverConfigE2EE, peer.POSIX, c.simple, c.disableV6),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The strings that need to be commented should just have a # added to them here instead of using a loop to add them later. Like "# " + peer..... Note that there should also be a space after the # to improve readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants