Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Output host_name property on configuration API endpoint

Oliver Günther42b406b63d66
diff --git a/docs/api/apiv3/components/schemas/configuration_model.yml b/docs/api/apiv3/components/schemas/configuration_model.yml
index d7d93af5927..026aa429cc1 100644
--- a/docs/api/apiv3/components/schemas/configuration_model.yml
+++ b/docs/api/apiv3/components/schemas/configuration_model.yml
@@ -19,6 +19,7 @@ example:
userPreferences:
href: "/api/v3/my_preferences"
maximumAttachmentFileSize: 5242880
+ hostName: 'example.com:8080'
perPageOptions:
- 1
- 10
diff --git a/docs/api/apiv3/tags/configuration.yml b/docs/api/apiv3/tags/configuration.yml
index 1af5300498e..f0f22926498 100644
--- a/docs/api/apiv3/tags/configuration.yml
+++ b/docs/api/apiv3/tags/configuration.yml
@@ -20,4 +20,5 @@ description: |-
| :-----------------------: | -------------------------------------------------- | ---------- | --------------------------------- | -------------------- |
| maximumAttachmentFileSize | The maximum allowed size of an attachment in Bytes | Integer | | READ |
| perPageOptions | Page size steps to be offered in paginated list UI | Integer[] | | READ |
+ | hostName | The host name configured for the system | String | | READ |
name: Configuration
diff --git a/frontend/src/app/core/config/configuration.service.ts b/frontend/src/app/core/config/configuration.service.ts
index 21ff2d98694..6a1b8457baf 100644
--- a/frontend/src/app/core/config/configuration.service.ts
+++ b/frontend/src/app/core/config/configuration.service.ts
@@ -118,6 +118,10 @@ export class ConfigurationService {
return moment.localeData(I18n.locale).firstDayOfWeek();
}
+ public get hostName():string {
+ return this.systemPreference('hostName');
+ }
+
private loadConfiguration() {
return this
.apiV3Service
diff --git a/lib/api/v3/configuration/configuration_representer.rb b/lib/api/v3/configuration/configuration_representer.rb
index 4cc17d83981..9da92a4337c 100644
--- a/lib/api/v3/configuration/configuration_representer.rb
+++ b/lib/api/v3/configuration/configuration_representer.rb
@@ -73,6 +73,12 @@ module API
},
render_nil: true
+ property :host_name,
+ getter: ->(*) {
+ Setting.host_name
+ },
+ render_nil: true
+
property :user_preferences,
embedded: true,
exec_context: :decorator,