Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 2.24 KB

README.md

File metadata and controls

53 lines (38 loc) · 2.24 KB

Go Report Card License CI workflow Release workflow SLSA 3

VeriNotes

Simple application for note taking, meant for demos.

Connecting to Postgres

There's a struct that is used with envconfig:

// store.go
type Config struct {
	SessionDuration  time.Duration
	PostgresUser     string `split_words:"true"`
	PostgresPassword string `split_words:"true"`
	PostgresDbName   string `default:"verinotes" split_words:"true"`
	PostgresHost     string `split_words:"true"`
	PostgresPort     string `default:"5432" split_words:"true"`
	PostgresSslMode  string `default:"disable" split_words:"true"`
}

It's only mandatory to set the host, user and password. If the user is not set VeriNotes will default to using embedded sqlite3.

The prefix for env variables is VN, for example:

export VN_POSTGRES_USER=postgres
export VN_POSTGRES_PASSWORD=veristrongpassword
export VN_POSTGRES_HOST=postgres-postgresql.verinotes.svc.cluster.local

Note that the password is printed into logs which is typically fine in demos, maybe it could be hidden behind a flag though...

Build with ko

You can build VeriNotes without Docker, just use ko. There's already a .ko.yaml file in the repo. BUT note that you must change to a different base image if you want to produce an image which works with the embedded SQLite since it needs CGO and ko by default builds a minimalistic image with CGO_ENABLE=0. In future maybe we build multiple tags so there's one that only works with Postgres and one that works standalone.

Developing

make ent-gen
make be-dev
make fe-dev

Now you can deploy the Go backend and Svelte frontend separately when you change one or the other. Svelte of course hot reloads, but the backend you have to keep rebuilding.