diff options
| author | Maisam <maisam.vahidsafa@gmail.com> | 2024-05-25 11:15:06 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-25 11:15:06 +0300 |
| commit | c422214ae8e1da9d9ed210f85f63356f8943a2cf (patch) | |
| tree | 2aba053e243d0d589e7e32576b0f82b9c710bff3 /web/service | |
| parent | bd2d7bce62eb39009e1dfa819e32a5be725c1a4b (diff) | |
Add webBasePath update feature to CLI (#2300)
Diffstat (limited to 'web/service')
| -rw-r--r-- | web/service/setting.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/web/service/setting.go b/web/service/setting.go index 9e740059..69b1fece 100644 --- a/web/service/setting.go +++ b/web/service/setting.go @@ -352,6 +352,16 @@ func (s *SettingService) GetSecret() ([]byte, error) { return []byte(secret), err } +func (s *SettingService) SetBasePath(basePath string) error { + if !strings.HasPrefix(basePath, "/") { + basePath = "/" + basePath + } + if !strings.HasSuffix(basePath, "/") { + basePath += "/" + } + return s.setString("webBasePath", basePath) +} + func (s *SettingService) GetBasePath() (string, error) { basePath, err := s.getString("webBasePath") if err != nil { |
