Skip to content

Instantly share code, notes, and snippets.

@asticode
Last active January 12, 2020 17:03
Show Gist options
  • Save asticode/a3a002ae5a093c269e34001f0fc53eeb to your computer and use it in GitHub Desktop.
Save asticode/a3a002ae5a093c269e34001f0fc53eeb to your computer and use it in GitHub Desktop.
astibob index
package main
import (
"flag"
"fmt"
"log"
"github.com/asticode/go-astibob"
"github.com/asticode/go-astibob/index"
)
func main() {
// Parse flags
flag.Parse()
// Create logger
l := log.New(log.Writer(), log.Prefix(), log.Flags())
// Create index
i, err := index.New(index.Options{
Server: astibob.ServerOptions{
Addr: "127.0.0.1:4000",
Password: "admin",
Username: "admin",
},
}, l)
if err != nil {
l.Fatal(fmt.Errorf("main: creating index failed: %w", err))
}
defer i.Close()
// Handle signals
i.HandleSignals()
// Serve
i.Serve()
// Blocking pattern
i.Wait()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment