Last active
January 12, 2020 17:03
-
-
Save asticode/a3a002ae5a093c269e34001f0fc53eeb to your computer and use it in GitHub Desktop.
astibob index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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