diff --git a/Dockerfile b/Dockerfile index cc8cba16..e14d1fb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ WORKDIR /mayfly # Copy the go source for building server COPY server . -RUN go mod download +RUN go mod tidy && go mod download COPY --from=fe-builder /mayfly/dist /mayfly/static/static diff --git a/mayfly_go_web/src/views/login/component/AccountLogin.vue b/mayfly_go_web/src/views/login/component/AccountLogin.vue index 5bae8a1a..61776621 100644 --- a/mayfly_go_web/src/views/login/component/AccountLogin.vue +++ b/mayfly_go_web/src/views/login/component/AccountLogin.vue @@ -132,7 +132,7 @@ import { nextTick, onMounted, ref, toRefs, reactive, computed } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { ElMessage } from 'element-plus'; import { initRouter } from '@/router/index'; -import { saveToken, saveUser, setSession } from '@/common/utils/storage'; +import { saveToken, saveUser } from '@/common/utils/storage'; import { formatAxis } from '@/common/utils/format'; import openApi from '@/common/openApi'; import { RsaEncrypt } from '@/common/rsa'; diff --git a/mayfly_go_web/vite.config.ts b/mayfly_go_web/vite.config.ts index 0138d5d4..7275857f 100644 --- a/mayfly_go_web/vite.config.ts +++ b/mayfly_go_web/vite.config.ts @@ -42,9 +42,9 @@ const viteConfig: UserConfig = { chunkSizeWarningLimit: 1500, rollupOptions: { output: { - entryFileNames: `assets/[hash].[name].js`, - chunkFileNames: `assets/[hash].[name].js`, - assetFileNames: `assets/[name].[hash].[ext]`, + entryFileNames: `assets/[name]-[hash].js`, + chunkFileNames: `assets/[name]-[hash].js`, + assetFileNames: `assets/[name]-[hash].[ext]`, compact: true, manualChunks: { vue: ['vue', 'vue-router', 'pinia'], diff --git a/server/internal/db/dbm/dialect_pgsql.go b/server/internal/db/dbm/dialect_pgsql.go index 3d4cc6fa..2e66ee46 100644 --- a/server/internal/db/dbm/dialect_pgsql.go +++ b/server/internal/db/dbm/dialect_pgsql.go @@ -8,6 +8,7 @@ import ( "mayfly-go/pkg/errorx" "mayfly-go/pkg/utils/anyx" "mayfly-go/pkg/utils/collx" + "mayfly-go/pkg/utils/netx" "net" "strings" "time" @@ -41,7 +42,7 @@ func getPgsqlDB(d *DbInfo) (*sql.DB, error) { } } - dsn := fmt.Sprintf("host=%s port=%d user=%s password=%s %s sslmode=disable", d.Host, d.Port, d.Username, d.Password, dbParam) + dsn := fmt.Sprintf("host=%s port=%d user=%s password=%s %s sslmode=disable connect_timeout=8", d.Host, d.Port, d.Username, d.Password, dbParam) // 存在额外指定参数,则拼接该连接参数 if d.Params != "" { // 存在指定的db,则需要将dbInstance配置中的parmas排除掉dbname和search_path @@ -79,7 +80,8 @@ func (pd *PqSqlDialer) Dial(network, address string) (net.Conn, error) { return nil, err } if sshConn, err := sshTunnel.GetDialConn("tcp", address); err == nil { - return sshConn, nil + // 将ssh conn包装,否则会返回错误: ssh: tcpChan: deadline not supported + return &netx.WrapSshConn{Conn: sshConn}, nil } else { return nil, err } diff --git a/server/pkg/utils/netx/ssh_conn_wrap.go b/server/pkg/utils/netx/ssh_conn_wrap.go index 9ec1201c..250f3e8f 100644 --- a/server/pkg/utils/netx/ssh_conn_wrap.go +++ b/server/pkg/utils/netx/ssh_conn_wrap.go @@ -26,7 +26,7 @@ func (c *WrapSshConn) RemoteAddr() net.Addr { return c.Conn.RemoteAddr() } func (c *WrapSshConn) SetDeadline(t time.Time) error { - return c.Conn.SetDeadline(t) + return nil } func (c *WrapSshConn) SetReadDeadline(t time.Time) error { return nil