diff --git a/CHANGELOG.md b/CHANGELOG.md index f419916..33108d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +Breaking changes: +* Use `sshportal server` instead of `sshportal` to start a new server (nothing to change if using the docker image) + +Changes: * Fix connection failure when sending too many environment variables (fix [#22](https://github.com/moul/sshportal/issues/22)) * Fix panic when entering empty command (fix [#13](https://github.com/moul/sshportal/issues/13)) diff --git a/Dockerfile b/Dockerfile index 00ac0fa..5a29c40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,3 +8,4 @@ RUN make _docker_install FROM scratch COPY --from=builder /go/bin/sshportal /bin/sshportal ENTRYPOINT ["/bin/sshportal"] +CMD ["server"] diff --git a/examples/mysql/docker-compose.yml b/examples/mysql/docker-compose.yml index 94c78b5..e7f2e1a 100644 --- a/examples/mysql/docker-compose.yml +++ b/examples/mysql/docker-compose.yml @@ -9,7 +9,7 @@ services: condition: service_healthy links: - mysql - command: --db-driver=mysql --debug --db-conn="root:root@tcp(mysql:3306)/db?charset=utf8&parseTime=true&loc=Local" + command: server --db-driver=mysql --debug --db-conn="root:root@tcp(mysql:3306)/db?charset=utf8&parseTime=true&loc=Local" ports: - 2222:2222 diff --git a/main.go b/main.go index 5b6c21c..f8e3030 100644 --- a/main.go +++ b/main.go @@ -45,43 +45,49 @@ func main() { app.Author = "Manfred Touron" app.Version = Version + " (" + GitSha + ")" app.Email = "https://github.com/moul/sshportal" - app.Flags = []cli.Flag{ - cli.StringFlag{ - Name: "bind-address, b", - EnvVar: "SSHPORTAL_BIND", - Value: ":2222", - Usage: "SSH server bind address", - }, - cli.StringFlag{ - Name: "db-driver", - Value: "sqlite3", - Usage: "GORM driver (sqlite3)", - }, - cli.StringFlag{ - Name: "db-conn", - Value: "./sshportal.db", - Usage: "GORM connection string", - }, - cli.BoolFlag{ - Name: "debug, D", - Usage: "Display debug information", - }, - cli.StringFlag{ - Name: "config-user", - Usage: "SSH user that spawns a configuration shell", - Value: "admin", - }, - cli.StringFlag{ - Name: "healthcheck-user", - Usage: "SSH user that returns healthcheck status without checking the SSH key", - Value: "healthcheck", - }, - cli.StringFlag{ - Name: "aes-key", - Usage: "Encrypt sensitive data in database (length: 16, 24 or 32)", + app.Commands = []cli.Command{ + { + Name: "server", + Usage: "Start sshportal server", + Action: server, + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "bind-address, b", + EnvVar: "SSHPORTAL_BIND", + Value: ":2222", + Usage: "SSH server bind address", + }, + cli.StringFlag{ + Name: "db-driver", + Value: "sqlite3", + Usage: "GORM driver (sqlite3)", + }, + cli.StringFlag{ + Name: "db-conn", + Value: "./sshportal.db", + Usage: "GORM connection string", + }, + cli.BoolFlag{ + Name: "debug, D", + Usage: "Display debug information", + }, + cli.StringFlag{ + Name: "config-user", + Usage: "SSH user that spawns a configuration shell", + Value: "admin", + }, + cli.StringFlag{ + Name: "healthcheck-user", + Usage: "SSH user that returns healthcheck status without checking the SSH key", + Value: "healthcheck", + }, + cli.StringFlag{ + Name: "aes-key", + Usage: "Encrypt sensitive data in database (length: 16, 24 or 32)", + }, + }, }, } - app.Action = server if err := app.Run(os.Args); err != nil { log.Fatalf("error: %v", err) }