Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Unix Domain Socket support #106

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ myduckserver
*.test
.vscode/
pipes/
*.sock
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
var (
address = "0.0.0.0"
port = 3306
socket string
dataDirectory = "."
dbFileName = "mysql.db"
logLevel = int(logrus.InfoLevel)
Expand All @@ -53,6 +54,7 @@ var (
func init() {
flag.StringVar(&address, "address", address, "The address to bind to.")
flag.IntVar(&port, "port", port, "The port to bind to.")
flag.StringVar(&socket, "socket", socket, "The Unix domain socket to bind to.")
flag.StringVar(&dataDirectory, "datadir", dataDirectory, "The directory to store the database.")
flag.IntVar(&logLevel, "loglevel", logLevel, "The log level to use.")

Expand Down Expand Up @@ -111,6 +113,7 @@ func main() {
config := server.Config{
Protocol: "tcp",
Address: fmt.Sprintf("%s:%d", address, port),
Socket: socket,
}
s, err := server.NewServerWithHandler(config, engine, backend.NewSessionBuilder(provider, pool), nil, backend.WrapHandler(pool))
if err != nil {
Expand Down