Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Require —host to start with http:// or https:// and change the default port from 8080 to 80

天舟fdd0858dfdb9
diff --git a/Dockerfile b/Dockerfile
index a38771a125..4f8901c31e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -63,6 +63,6 @@ COPY --from=backend /backend-build/bytebase /usr/local/bin/
# Directory to store the data, which can be referenced as the mounting point.
RUN mkdir -p /var/opt/bytebase
-CMD ["--host", "http://localhost", "--port", "8080", "--data", "/var/opt/bytebase"]
+CMD ["--host", "http://localhost", "--port", "80", "--data", "/var/opt/bytebase"]
ENTRYPOINT ["bytebase"]
\ No newline at end of file
diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.go
index eadab408f4..9fb95152bb 100644
--- a/bin/server/cmd/root.go
+++ b/bin/server/cmd/root.go
@@ -106,8 +106,8 @@ func Execute() error {
}
func init() {
- rootCmd.PersistentFlags().StringVar(&host, "host", "http://localhost", "host where Bytebase is running e.g. https://bytebase.example.com")
- rootCmd.PersistentFlags().IntVar(&port, "port", 8080, "port where Bytebase is running e.g. 8080")
+ rootCmd.PersistentFlags().StringVar(&host, "host", "https://localhost", "host where Bytebase is accessed from, must start with http:// or https://. This is used by Bytebase to create the webhook callback endpoint for VCS integration")
+ rootCmd.PersistentFlags().IntVar(&port, "port", 80, "port where Bytebase is accessed from. This is also used by Bytebase to create the webhook callback endpoint for VCS integration")
rootCmd.PersistentFlags().StringVar(&dataDir, "data", ".", "directory where Bytebase stores data. If relative path is supplied, then the path is relative to the directory where bytebase is under")
rootCmd.PersistentFlags().BoolVar(&readonly, "readonly", false, "whether to run in read-only mode")
rootCmd.PersistentFlags().BoolVar(&demo, "demo", false, "whether to run using demo data")
@@ -145,6 +145,11 @@ type main struct {
}
func preStart() error {
+ if !strings.HasPrefix(host, "http://") && !strings.HasPrefix(host, "https://") {
+ error := fmt.Errorf("--host %s must start with http:// or https://", host)
+ return error
+ }
+
// Convert to absolute path if relative path is supplied.
if !filepath.IsAbs(dataDir) {
absDir, err := filepath.Abs(filepath.Dir(os.Args[0]) + "/" + dataDir)