diff --git a/app/http/controllers/plugins/mysql_controller.go b/app/http/controllers/plugins/mysql_controller.go index d12b1cfb..51af0eb2 100644 --- a/app/http/controllers/plugins/mysql_controller.go +++ b/app/http/controllers/plugins/mysql_controller.go @@ -63,12 +63,9 @@ func (r *MySQLController) Load(ctx http.Context) http.Response { return controllers.Error(ctx, http.StatusUnprocessableEntity, "MySQL root密码为空") } - status, err := tools.ServiceStatus("mysqld") - if err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, "获取MySQL状态失败") - } + status, _ := tools.ServiceStatus("mysqld") if !status { - return controllers.Error(ctx, http.StatusInternalServerError, "MySQL 未运行") + return controllers.Success(ctx, []types.NV{}) } raw, err := tools.Exec("/www/server/mysql/bin/mysqladmin -uroot -p" + rootPassword + " extended-status 2>&1") @@ -220,10 +217,20 @@ func (r *MySQLController) DatabaseList(ctx http.Context) http.Response { db, err := sql.Open("mysql", "root:"+rootPassword+"@unix(/tmp/mysql.sock)/") if err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) + return controllers.Success(ctx, http.Json{ + "total": 0, + "items": []database{}, + }) } defer db.Close() + if err = db.Ping(); err != nil { + return controllers.Success(ctx, http.Json{ + "total": 0, + "items": []database{}, + }) + } + rows, err := db.Query("SHOW DATABASES") if err != nil { return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) @@ -432,10 +439,20 @@ func (r *MySQLController) UserList(ctx http.Context) http.Response { rootPassword := r.setting.Get(models.SettingKeyMysqlRootPassword) db, err := sql.Open("mysql", "root:"+rootPassword+"@unix(/tmp/mysql.sock)/") if err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) + return controllers.Success(ctx, http.Json{ + "total": 0, + "items": []user{}, + }) } defer db.Close() + if err = db.Ping(); err != nil { + return controllers.Success(ctx, http.Json{ + "total": 0, + "items": []user{}, + }) + } + rows, err := db.Query("SELECT user, host FROM mysql.user") if err != nil { return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) diff --git a/app/http/controllers/plugins/openresty_controller.go b/app/http/controllers/plugins/openresty_controller.go index 2b7cd913..4eb6d9b4 100644 --- a/app/http/controllers/plugins/openresty_controller.go +++ b/app/http/controllers/plugins/openresty_controller.go @@ -10,6 +10,7 @@ import ( "github.com/TheTNB/panel/app/http/controllers" "github.com/TheTNB/panel/pkg/tools" + "github.com/TheTNB/panel/types" ) type OpenRestyController struct { @@ -112,21 +113,17 @@ func (r *OpenRestyController) Load(ctx http.Context) http.Response { client := resty.New().SetTimeout(10 * time.Second) resp, err := client.R().Get("http://127.0.0.1/nginx_status") if err != nil || !resp.IsSuccess() { - return controllers.Error(ctx, http.StatusInternalServerError, "获取负载失败") + return controllers.Success(ctx, []types.NV{}) } raw := resp.String() - type nginxStatus struct { - Name string `json:"name"` - Value string `json:"value"` - } - var data []nginxStatus + var data []types.NV workers, err := tools.Exec("ps aux | grep nginx | grep 'worker process' | wc -l") if err != nil { return controllers.Error(ctx, http.StatusInternalServerError, "获取负载失败") } - data = append(data, nginxStatus{ + data = append(data, types.NV{ Name: "工作进程", Value: workers, }) @@ -136,14 +133,14 @@ func (r *OpenRestyController) Load(ctx http.Context) http.Response { return controllers.Error(ctx, http.StatusInternalServerError, "获取负载失败") } mem := tools.FormatBytes(cast.ToFloat64(out)) - data = append(data, nginxStatus{ + data = append(data, types.NV{ Name: "内存占用", Value: mem, }) match := regexp.MustCompile(`Active connections:\s+(\d+)`).FindStringSubmatch(raw) if len(match) == 2 { - data = append(data, nginxStatus{ + data = append(data, types.NV{ Name: "活跃连接数", Value: match[1], }) @@ -151,15 +148,15 @@ func (r *OpenRestyController) Load(ctx http.Context) http.Response { match = regexp.MustCompile(`server accepts handled requests\s+(\d+)\s+(\d+)\s+(\d+)`).FindStringSubmatch(raw) if len(match) == 4 { - data = append(data, nginxStatus{ + data = append(data, types.NV{ Name: "总连接次数", Value: match[1], }) - data = append(data, nginxStatus{ + data = append(data, types.NV{ Name: "总握手次数", Value: match[2], }) - data = append(data, nginxStatus{ + data = append(data, types.NV{ Name: "总请求次数", Value: match[3], }) @@ -167,15 +164,15 @@ func (r *OpenRestyController) Load(ctx http.Context) http.Response { match = regexp.MustCompile(`Reading:\s+(\d+)\s+Writing:\s+(\d+)\s+Waiting:\s+(\d+)`).FindStringSubmatch(raw) if len(match) == 4 { - data = append(data, nginxStatus{ + data = append(data, types.NV{ Name: "请求数", Value: match[1], }) - data = append(data, nginxStatus{ + data = append(data, types.NV{ Name: "响应数", Value: match[2], }) - data = append(data, nginxStatus{ + data = append(data, types.NV{ Name: "驻留进程", Value: match[3], }) diff --git a/app/http/controllers/plugins/postgresql_controller.go b/app/http/controllers/plugins/postgresql_controller.go index bc0a7ca7..cf85adb9 100644 --- a/app/http/controllers/plugins/postgresql_controller.go +++ b/app/http/controllers/plugins/postgresql_controller.go @@ -87,12 +87,9 @@ func (r *PostgreSQLController) SaveUserConfig(ctx http.Context) http.Response { // Load 获取负载 func (r *PostgreSQLController) Load(ctx http.Context) http.Response { - status, err := tools.ServiceStatus("postgresql") - if err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, "获取PostgreSQL状态失败") - } + status, _ := tools.ServiceStatus("postgresql") if !status { - return controllers.Error(ctx, http.StatusInternalServerError, "PostgreSQL已停止运行") + return controllers.Success(ctx, []types.NV{}) } time, err := tools.Exec(`echo "select pg_postmaster_start_time();" | su - postgres -c "psql" | sed -n 3p | cut -d'.' -f1`) @@ -148,12 +145,25 @@ func (r *PostgreSQLController) ClearLog(ctx http.Context) http.Response { // DatabaseList 获取数据库列表 func (r *PostgreSQLController) DatabaseList(ctx http.Context) http.Response { + type database struct { + Name string `json:"name"` + Owner string `json:"owner"` + Encoding string `json:"encoding"` + } + db, err := sql.Open("postgres", "host=localhost port=5432 user=postgres dbname=postgres sslmode=disable") if err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) + return controllers.Success(ctx, http.Json{ + "total": 0, + "items": []database{}, + }) } + if err = db.Ping(); err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) + return controllers.Success(ctx, http.Json{ + "total": 0, + "items": []database{}, + }) } query := ` @@ -167,12 +177,6 @@ func (r *PostgreSQLController) DatabaseList(ctx http.Context) http.Response { } defer rows.Close() - type database struct { - Name string `json:"name"` - Owner string `json:"owner"` - Encoding string `json:"encoding"` - } - var databases []database for rows.Next() { var db database @@ -370,12 +374,23 @@ func (r *PostgreSQLController) RestoreBackup(ctx http.Context) http.Response { // RoleList 角色列表 func (r *PostgreSQLController) RoleList(ctx http.Context) http.Response { + type role struct { + Role string `json:"role"` + Attributes []string `json:"attributes"` + } + db, err := sql.Open("postgres", "host=localhost port=5432 user=postgres dbname=postgres sslmode=disable") if err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) + return controllers.Success(ctx, http.Json{ + "total": 0, + "items": []role{}, + }) } if err = db.Ping(); err != nil { - return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) + return controllers.Success(ctx, http.Json{ + "total": 0, + "items": []role{}, + }) } query := ` @@ -394,11 +409,6 @@ func (r *PostgreSQLController) RoleList(ctx http.Context) http.Response { } defer rows.Close() - type role struct { - Role string `json:"role"` - Attributes []string `json:"attributes"` - } - var roles []role for rows.Next() { var r role diff --git a/app/http/requests/cert/cert_store.go b/app/http/requests/cert/cert_store.go index 6d3131ec..d0b5129a 100644 --- a/app/http/requests/cert/cert_store.go +++ b/app/http/requests/cert/cert_store.go @@ -3,16 +3,15 @@ package requests import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/validation" - "github.com/spf13/cast" ) type CertStore struct { Type string `form:"type" json:"type"` Domains []string `form:"domains" json:"domains"` AutoRenew bool `form:"auto_renew" json:"auto_renew"` - UserID uint `form:"user_id" json:"user_id"` - DNSID uint `form:"dns_id" json:"dns_id"` - WebsiteID uint `form:"website_id" json:"website_id"` + UserID uint `form:"user_id" json:"user_id" filter:"uint"` + DNSID uint `form:"dns_id" json:"dns_id" filter:"uint"` + WebsiteID uint `form:"website_id" json:"website_id" filter:"uint"` } func (r *CertStore) Authorize(ctx http.Context) error { @@ -39,29 +38,5 @@ func (r *CertStore) Attributes(ctx http.Context) map[string]string { } func (r *CertStore) PrepareForValidation(ctx http.Context, data validation.Data) error { - // TODO 由于验证器 filter 标签的问题,暂时这里这样处理 - userID, exist := data.Get("user_id") - if exist { - err := data.Set("user_id", cast.ToUint(userID)) - if err != nil { - return err - } - } - dnsID, exist := data.Get("dns_id") - if exist { - err := data.Set("dns_id", cast.ToUint(dnsID)) - if err != nil { - return err - } - - } - websiteID, exist := data.Get("website_id") - if exist { - err := data.Set("website_id", cast.ToUint(websiteID)) - if err != nil { - return err - } - } - return nil } diff --git a/app/http/requests/cert/cert_update.go b/app/http/requests/cert/cert_update.go index 05bc6307..611ae055 100644 --- a/app/http/requests/cert/cert_update.go +++ b/app/http/requests/cert/cert_update.go @@ -3,7 +3,6 @@ package requests import ( "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/validation" - "github.com/spf13/cast" ) type CertUpdate struct { @@ -11,9 +10,9 @@ type CertUpdate struct { Type string `form:"type" json:"type"` Domains []string `form:"domains" json:"domains"` AutoRenew bool `form:"auto_renew" json:"auto_renew"` - UserID uint `form:"user_id" json:"user_id"` - DNSID uint `form:"dns_id" json:"dns_id"` - WebsiteID uint `form:"website_id" json:"website_id"` + UserID uint `form:"user_id" json:"user_id" filter:"uint"` + DNSID uint `form:"dns_id" json:"dns_id" filter:"uint"` + WebsiteID uint `form:"website_id" json:"website_id" filter:"uint"` } func (r *CertUpdate) Authorize(ctx http.Context) error { @@ -41,29 +40,5 @@ func (r *CertUpdate) Attributes(ctx http.Context) map[string]string { } func (r *CertUpdate) PrepareForValidation(ctx http.Context, data validation.Data) error { - // TODO 由于验证器 filter 标签的问题,暂时这里这样处理 - userID, exist := data.Get("user_id") - if exist { - err := data.Set("user_id", cast.ToUint(userID)) - if err != nil { - return err - } - } - dnsID, exist := data.Get("dns_id") - if exist { - err := data.Set("dns_id", cast.ToUint(dnsID)) - if err != nil { - return err - } - - } - websiteID, exist := data.Get("website_id") - if exist { - err := data.Set("website_id", cast.ToUint(websiteID)) - if err != nil { - return err - } - } - return nil } diff --git a/app/http/requests/file/archive.go b/app/http/requests/file/archive.go index 93fc60f4..1a45655d 100644 --- a/app/http/requests/file/archive.go +++ b/app/http/requests/file/archive.go @@ -17,8 +17,8 @@ func (r *Archive) Authorize(ctx http.Context) error { func (r *Archive) Rules(ctx http.Context) map[string]string { return map[string]string{ "paths": "array", - "paths.*": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, - "file": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_not_exists`, + "paths.*": `regex:^/.*$|path_exists`, + "file": `regex:^/.*$|path_not_exists`, } } diff --git a/app/http/requests/file/copy.go b/app/http/requests/file/copy.go index 52e30cec..3da09b23 100644 --- a/app/http/requests/file/copy.go +++ b/app/http/requests/file/copy.go @@ -16,8 +16,8 @@ func (r *Copy) Authorize(ctx http.Context) error { func (r *Copy) Rules(ctx http.Context) map[string]string { return map[string]string{ - "source": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, - "target": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, + "source": `regex:^/.*$|path_exists`, + "target": `regex:^/.*$`, } } diff --git a/app/http/requests/file/exist.go b/app/http/requests/file/exist.go index 189533fd..07822012 100644 --- a/app/http/requests/file/exist.go +++ b/app/http/requests/file/exist.go @@ -15,7 +15,7 @@ func (r *Exist) Authorize(ctx http.Context) error { func (r *Exist) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": `regex:^/([a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*)?$|path_exists`, + "path": `regex:^/.*$|path_exists`, } } diff --git a/app/http/requests/file/move.go b/app/http/requests/file/move.go index 99d7b1a9..cd7d7bba 100644 --- a/app/http/requests/file/move.go +++ b/app/http/requests/file/move.go @@ -16,8 +16,8 @@ func (r *Move) Authorize(ctx http.Context) error { func (r *Move) Rules(ctx http.Context) map[string]string { return map[string]string{ - "source": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, - "target": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, + "source": `regex:^/.*$|path_exists`, + "target": `regex:^/.*$`, } } diff --git a/app/http/requests/file/not_exist.go b/app/http/requests/file/not_exist.go index f8de36c0..a62eff0b 100644 --- a/app/http/requests/file/not_exist.go +++ b/app/http/requests/file/not_exist.go @@ -15,7 +15,7 @@ func (r *NotExist) Authorize(ctx http.Context) error { func (r *NotExist) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_not_exists`, + "path": `regex:^/.*$|path_not_exists`, } } diff --git a/app/http/requests/file/permission.go b/app/http/requests/file/permission.go index a3a3dc1b..687feee1 100644 --- a/app/http/requests/file/permission.go +++ b/app/http/requests/file/permission.go @@ -18,7 +18,7 @@ func (r *Permission) Authorize(ctx http.Context) error { func (r *Permission) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, + "path": `regex:^/.*$|path_exists`, "mode": "regex:^[0-7]{3}$|uint", "owner": "regex:^[a-zA-Z0-9_-]+$", "group": "regex:^[a-zA-Z0-9_-]+$", diff --git a/app/http/requests/file/save.go b/app/http/requests/file/save.go index 2680f0d7..4abecd2e 100644 --- a/app/http/requests/file/save.go +++ b/app/http/requests/file/save.go @@ -16,7 +16,7 @@ func (r *Save) Authorize(ctx http.Context) error { func (r *Save) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, + "path": `regex:^/.*$|path_exists`, "content": "required|string", } } diff --git a/app/http/requests/file/search.go b/app/http/requests/file/search.go index 800630ff..79c0af25 100644 --- a/app/http/requests/file/search.go +++ b/app/http/requests/file/search.go @@ -16,7 +16,7 @@ func (r *Search) Authorize(ctx http.Context) error { func (r *Search) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, + "path": `regex:^/.*$|path_exists`, "keyword": "required|string", } } diff --git a/app/http/requests/file/un_archive.go b/app/http/requests/file/un_archive.go index 5c87abe4..10277b22 100644 --- a/app/http/requests/file/un_archive.go +++ b/app/http/requests/file/un_archive.go @@ -16,8 +16,8 @@ func (r *UnArchive) Authorize(ctx http.Context) error { func (r *UnArchive) Rules(ctx http.Context) map[string]string { return map[string]string{ - "file": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, - "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_not_exists`, + "file": `regex:^/.*$|path_exists`, + "path": `regex:^/.*$|path_not_exists`, } } diff --git a/app/http/requests/file/upload.go b/app/http/requests/file/upload.go index cfbb53b7..f0370236 100644 --- a/app/http/requests/file/upload.go +++ b/app/http/requests/file/upload.go @@ -18,7 +18,7 @@ func (r *Upload) Authorize(ctx http.Context) error { func (r *Upload) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, + "path": `regex:^/.*$`, "file": "required", } } diff --git a/app/http/requests/plugins/rsync/create.go b/app/http/requests/plugins/rsync/create.go index 3fa896c8..60062abd 100644 --- a/app/http/requests/plugins/rsync/create.go +++ b/app/http/requests/plugins/rsync/create.go @@ -21,7 +21,7 @@ func (r *Create) Authorize(ctx http.Context) error { func (r *Create) Rules(ctx http.Context) map[string]string { return map[string]string{ "name": "required|regex:^[a-zA-Z0-9-_]+$", - "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, + "path": `regex:^/.*$`, "comment": "string", "auth_user": "required|regex:^[a-zA-Z0-9-_]+$", "secret": "required|min_len:8", diff --git a/app/http/requests/plugins/rsync/update.go b/app/http/requests/plugins/rsync/update.go index 58e62574..df11db93 100644 --- a/app/http/requests/plugins/rsync/update.go +++ b/app/http/requests/plugins/rsync/update.go @@ -21,7 +21,7 @@ func (r *Update) Authorize(ctx http.Context) error { func (r *Update) Rules(ctx http.Context) map[string]string { return map[string]string{ "name": "required|regex:^[a-zA-Z0-9-_]+$", - "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, + "path": `regex:^/.*$`, "comment": "string", "auth_user": "required|regex:^[a-zA-Z0-9-_]+$", "secret": "required|min_len:8", diff --git a/app/http/requests/website/add.go b/app/http/requests/website/add.go index 62a5abed..c3ba9252 100644 --- a/app/http/requests/website/add.go +++ b/app/http/requests/website/add.go @@ -27,7 +27,7 @@ func (r *Add) Rules(ctx http.Context) map[string]string { "name": "required|regex:^[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)*$|not_exists:websites,name|not_in:phpmyadmin,mysql,panel,ssh", "domains": "required|slice", "ports": "required|slice", - "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, + "path": `regex:^/.*$`, "php": "required", "db": "bool", "db_type": "required_if:db,true|in:0,mysql,postgresql", diff --git a/config/app.go b/config/app.go index 4f0b5177..0f1e07bf 100644 --- a/config/app.go +++ b/config/app.go @@ -1,8 +1,6 @@ package config import ( - "path/filepath" - "github.com/goravel/framework/auth" "github.com/goravel/framework/cache" "github.com/goravel/framework/console" @@ -19,7 +17,6 @@ import ( "github.com/goravel/framework/queue" "github.com/goravel/framework/route" "github.com/goravel/framework/schedule" - "github.com/goravel/framework/support" "github.com/goravel/framework/support/carbon" "github.com/goravel/framework/testing" "github.com/goravel/framework/translation" @@ -33,7 +30,6 @@ import ( func Boot() {} func init() { - support.RootPath = "/www/panel" // TODO remove this line config := facades.Config() config.Add("app", map[string]any{ // Application Name @@ -78,7 +74,7 @@ func init() { // // The path to the language files for the application. You may change // the path to a different directory if you would like to customize it. - "lang_path": filepath.Join(support.RootPath, "lang"), + "lang_path": facades.App().ExecutablePath("lang"), // Encryption Key // diff --git a/config/database.go b/config/database.go index 57bdc74d..746e0007 100644 --- a/config/database.go +++ b/config/database.go @@ -1,10 +1,7 @@ package config import ( - "path/filepath" - "github.com/goravel/framework/facades" - "github.com/goravel/framework/support" ) func init() { @@ -17,7 +14,7 @@ func init() { "connections": map[string]any{ "panel": map[string]any{ "driver": "sqlite", - "database": config.Env("DB_FILE", filepath.Join(support.RootPath, "storage/panel.db")), + "database": config.Env("DB_FILE", facades.App().ExecutablePath("storage/panel.db")), "prefix": "", "singular": false, // Table name is singular }, diff --git a/config/filesystems.go b/config/filesystems.go index 133d2006..ef9d1185 100644 --- a/config/filesystems.go +++ b/config/filesystems.go @@ -1,10 +1,7 @@ package config import ( - "path/filepath" - "github.com/goravel/framework/facades" - "github.com/goravel/framework/support" ) func init() { @@ -27,7 +24,7 @@ func init() { "disks": map[string]any{ "local": map[string]any{ "driver": "local", - "root": filepath.Join(support.RootPath, "storage"), + "root": facades.App().ExecutablePath("storage"), }, }, }) diff --git a/config/http.go b/config/http.go index 9cc5cd07..ea0e15d3 100644 --- a/config/http.go +++ b/config/http.go @@ -1,11 +1,8 @@ package config import ( - "path/filepath" - "github.com/goravel/framework/contracts/route" "github.com/goravel/framework/facades" - "github.com/goravel/framework/support" ginfacades "github.com/goravel/gin/facades" ) @@ -42,9 +39,9 @@ func init() { // SSL Certificate "ssl": map[string]any{ // ca.pem - "cert": config.Env("APP_SSL_CERT", filepath.Join(support.RootPath, "storage/ssl.crt")), + "cert": config.Env("APP_SSL_CERT", facades.App().ExecutablePath("storage/ssl.crt")), // ca.key - "key": config.Env("APP_SSL_KEY", filepath.Join(support.RootPath, "storage/ssl.key")), + "key": config.Env("APP_SSL_KEY", facades.App().ExecutablePath("storage/ssl.key")), }, }, }) diff --git a/go.mod b/go.mod index 8050fcc2..0ac8d751 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,10 @@ require ( github.com/docker/go-connections v0.5.0 github.com/go-resty/resty/v2 v2.13.1 github.com/gookit/validate v1.5.2 - github.com/goravel/framework v1.14.1-0.20240608091017-72e9e3621f24 + github.com/goravel/framework v1.14.1-0.20240618022250-731b8d9930a3 github.com/goravel/gin v1.2.1 github.com/gorilla/websocket v1.5.3 + github.com/lib/pq v1.10.9 github.com/libdns/alidns v1.0.3 github.com/libdns/cloudflare v0.1.1 github.com/libdns/dnspod v0.0.3 @@ -121,7 +122,6 @@ require ( github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/klauspost/pgzip v1.2.6 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/lib/pq v1.10.9 // indirect github.com/lithammer/fuzzysearch v1.1.8 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/magiconair/properties v1.8.7 // indirect diff --git a/go.sum b/go.sum index 6ae0242e..f314fc23 100644 --- a/go.sum +++ b/go.sum @@ -276,8 +276,8 @@ github.com/gookit/validate v1.5.2 h1:i5I2OQ7WYHFRPRATGu9QarR9snnNHydvwSuHXaRWAV0 github.com/gookit/validate v1.5.2/go.mod h1:yuPy2WwDlwGRa06fFJ5XIO8QEwhRnTC2LmxmBa5SE14= github.com/goravel/file-rotatelogs/v2 v2.4.2 h1:g68AzbePXcm0V2CpUMc9j4qVzcDn7+7aoWSjZ51C0m4= github.com/goravel/file-rotatelogs/v2 v2.4.2/go.mod h1:23VuSW8cBS4ax5cmbV+5AaiLpq25b8UJ96IhbAkdo8I= -github.com/goravel/framework v1.14.1-0.20240608091017-72e9e3621f24 h1:LEE75NYDaUasNfcxHvQU7Bpfyt7kA2P8izMXAxFqK9w= -github.com/goravel/framework v1.14.1-0.20240608091017-72e9e3621f24/go.mod h1:xGI8IGkgJoqqjCE3ExbpUNJutbG1ZtjhFkzx68UuW7I= +github.com/goravel/framework v1.14.1-0.20240618022250-731b8d9930a3 h1:G9aMInp4s2pL/bpVXrUj+NUtnVU8i7T9t6vGUJ60NaM= +github.com/goravel/framework v1.14.1-0.20240618022250-731b8d9930a3/go.mod h1:RTwF0A7HySf5i+2jptT9oyFqmQAiQubWn1AQrJAzPWg= github.com/goravel/gin v1.2.1 h1:lnQX3NKUEaSx8x7AAJpoeVkXgi+MVQ9FXy4QywHQElo= github.com/goravel/gin v1.2.1/go.mod h1:Qt3NJysg/eoxXL4y/swwFUcfcIT7XG+xb0rWChweZfY= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=