Web server

Configuring a project.

This section covers how to customize the Go code generated by Gophersauce. These tags are located in your project’s GXML file.

  1. Main
  2. Shutdown
  3. Port
  4. Session Key
  5. Shell scripting

Main

The code specified here will be executed on application start. The contents of this tag is Go code, it is located at the root of your GXML file. For example :

<gos>
    ...
    <main> 
        fmt.Println("Logging from main function")   
    </main>
    ...
</gos>

Will translate into

func main(){
    ...
    fmt.Println("Logging from Main function")
    ...
}

Shutdown

The code specified here will be executed on application exit. The contents of this tag is Go code, it is located at the root of your GXML file. For example :

<gos>
    ...
    <shutdown> 
        fmt.Println("Powering off")   
    </shutdown>
    ...
</gos>

Port

(if deploy type is webapp) Specifies the port your web server should listen on.

<gos>
    ...
    <port>8080</port>
    ...
</gos>

Key

(if deploy type is webapp) Used as cookie store key for your web app.

<gos>
    ...
    <key>my-key-braah</key>
    ...
</gos>

Scripting

Run terminal commands after your build is finished with the <sh> tag.

Example:

<gos>
    ...
   <sh>echo "HelloWorld"</sh>
   <sh>git commit .</sh>
    ...
</gos>