Fibre
In this guide, we will discuss how to setup a Fibre project, that uses Onboardbase to manage its secrets(environment variables)
- This section assumes you already have a project set up in Onboardbase Dashboard. If you don't, please create an account and get started!
- This process is also extendable to other Golang framworks.
Setup a Fibre Project
From anywhere comfortable in your terminal, run:
$ mkdir myapp
$ cd my app
$ go mod init myapp
Install Fibre into your myapp project
go get github.com/gofiber/fiber/v2
Create a server.go
file inside your project and add this code.
package main
import "github.com/gofiber/fiber/v2"
func main() {
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World!")
})
app.Listen(":3000")
}
run your project
go run server.go
Install Onboardbase CLI
Follow the installation guide to set up Onboardbase CLI for your machine.
Verify installation with onboardbase --version
which would output the version of the CLI you just installed.
Authenticate Onboardbase CLI
From anywhere in your terminal, run onboardbase login
, and accept to open the page in a browser.
On the authorization page, enter your email, and a confirmation link will be sent to the email. Click on the link, and your CLI should be authorized. Check your terminal to confirm.
Setup Onboardbase CLI
After successful installation, from the React Project directory in your terminal, run:
onboardbase setup
This would list all your projects, select the fibre project, select the development environment and accept to add .onboardbase.yaml to your .gitignore
file.
This would create an .onboardbase.yaml file that has all the details you selected during the setup and that would be used by the build script to know which secrets to pull into your fibre project.
Building with Onboardbase CLI
Since we have all our secrets on Onboardbase, we would use the build tool from Onboardbase to load secrets into the project.
To do this, you would have to change your start command from
$ go run server.go
to this
$ onboardbase run -c 'go run server.go'
Notice how we now use onboardbase run
to serve the project.
The secrets are available through: os.Getenv()
Awesome!
Updated about 1 year ago