Skip to content

Commit

Permalink
update home endpoint to add portal config information
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Sep 3, 2024
1 parent 16fedb9 commit fc6635f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gem 'json-ld'


# Rack middleware
gem 'ffi'
gem 'ffi', '~> 1.16.3'
gem 'rack-accept', '~> 0.4'
gem 'rack-attack', '~> 6.6.1', require: 'rack/attack'
gem 'rack-cache', '~> 1.13.0'
Expand Down Expand Up @@ -51,7 +51,7 @@ gem 'ncbo_cron', git: 'https://github.com/ontoportal-lirmm/ncbo_cron.git', branc
gem 'ncbo_ontology_recommender', git: 'https://github.com/ncbo/ncbo_ontology_recommender.git', branch: 'master'
gem 'goo', github: 'ontoportal-lirmm/goo', branch: 'development'
gem 'sparql-client', github: 'ontoportal-lirmm/sparql-client', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'feature/add-portal-config-model'

group :development do
# bcrypt_pbkdf and ed35519 is required for capistrano deployments when using ed25519 keys; see https://github.com/miloserdow/capistrano-deploy/issues/42
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: 9605eb44c4271c60bedda0520e85d8c3fa2513ac
branch: development
revision: d893c08a2c2f11c743fad520873b7f98b0805240
branch: feature/add-portal-config-model
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand Down Expand Up @@ -108,7 +108,7 @@ GEM
multi_json (~> 1.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
airbrussh (1.5.2)
airbrussh (1.5.3)
sshkit (>= 1.6.1, != 1.7.0)
backports (3.25.0)
base64 (0.2.0)
Expand Down Expand Up @@ -164,7 +164,7 @@ GEM
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.17.0)
ffi (1.16.3)
gapic-common (0.21.1)
faraday (>= 1.9, < 3.a)
faraday-retry (>= 1.0, < 3.a)
Expand All @@ -178,7 +178,7 @@ GEM
google-analytics-data (0.6.1)
google-analytics-data-v1beta (>= 0.11, < 2.a)
google-cloud-core (~> 1.6)
google-analytics-data-v1beta (0.13.0)
google-analytics-data-v1beta (0.13.1)
gapic-common (>= 0.21.1, < 2.a)
google-cloud-errors (~> 1.0)
google-apis-analytics_v3 (0.16.0)
Expand Down Expand Up @@ -236,7 +236,7 @@ GEM
kgio (2.11.4)
libxml-ruby (5.0.3)
link_header (0.0.8)
logger (1.6.0)
logger (1.6.1)
macaddr (1.7.2)
systemu (~> 2.6.5)
mail (2.8.1)
Expand All @@ -247,7 +247,7 @@ GEM
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0820)
mime-types-data (3.2024.0903)
mini_mime (1.1.5)
minitest (4.7.5)
minitest-stub_any_instance (1.0.3)
Expand All @@ -258,7 +258,7 @@ GEM
mutex_m (0.2.0)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.4.14)
net-imap (0.4.15)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -273,7 +273,7 @@ GEM
net-protocol
net-ssh (7.2.3)
netrc (0.11.0)
newrelic_rpm (9.12.0)
newrelic_rpm (9.13.0)
oj (3.16.1)
omni_logger (0.1.4)
logger
Expand Down Expand Up @@ -419,7 +419,7 @@ DEPENDENCIES
cube-ruby
ed25519 (>= 1.2, < 2.0)
faraday (~> 1.9)
ffi
ffi (~> 1.16.3)
goo!
haml (~> 5.2.2)
json-ld
Expand Down
31 changes: 31 additions & 0 deletions config/environments/config.rb.sample
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,37 @@ LinkedData.config do |config|
link: 'https://www.googleapis.com/oauth2/v3/userinfo'
}
}
config.ui_name = 'Bioportal'
config.title = 'NCBO BioPortal'
config.description = "The world's most comprehensive repository of biomedical ontologies "
config.color = '#234979'
config.logo = ''
config.fundedBy = [
{
img_src: 'https://identity.stanford.edu/wp-content/uploads/sites/3/2020/07/block-s-right.png',
url: 'https://www.stanford.edu',

},
{
img_src: 'https://ontoportal.org/images/logo.png',
url: 'https://ontoportal.org/',
}
]
config.federated_portals = {
'agroportal' => {
api: 'http://data.agroportal.lirmm.fr',
ui: 'http://agroportal.lirmm.fr',
apikey: '1cfae05f-9e67-486f-820b-b393dec5764b',
color: '#1e2251'
},
'bioportal' => {
api: 'http://data.bioontology.org',
ui: 'http://bioportal.bioontology.org',
apikey: '4a5011ea-75fa-4be6-8e89-f45c8c84844e',
color: '#234979'
},

}
end

Annotator.config do |config|
Expand Down
18 changes: 13 additions & 5 deletions controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class HomeController < ApplicationController

CLASS_MAP = {
Property: "LinkedData::Models::ObjectProperty"
Property: "LinkedData::Models::ObjectProperty"
}

namespace "/" do
Expand All @@ -28,14 +28,22 @@ class HomeController < ApplicationController
next if route.length < 3 || route.split("/").length > 2
route_no_slash = route.gsub("/", "")
context[route_no_slash] = route_to_class_map[route].type_uri.to_s if route_to_class_map[route] && route_to_class_map[route].respond_to?(:type_uri)
routes_hash[route_no_slash] = LinkedData.settings.rest_url_prefix+route_no_slash
routes_hash[route_no_slash] = LinkedData.settings.rest_url_prefix + route_no_slash
end
routes_hash["@context"] = context
reply ({links: routes_hash})

config = LinkedData::Models::PortalConfig.current_portal_config

federated_portals = config.federated_portals
federated_portals. transform_values! { |v| v.delete(:apikey) ; v }
config.init_federated_portals_settings(federated_portals)

config.class.link_to *routes_hash.map { |key, url| LinkedData::Hypermedia::Link.new(key, url, context[key]) }

reply config
end

get "documentation" do
@metadata_all = metadata_all.sort {|a,b| a[0].name <=> b[0].name}
@metadata_all = metadata_all.sort { |a, b| a[0].name <=> b[0].name }
haml "documentation/documentation".to_sym, :layout => "documentation/layout".to_sym
end

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
- "9393:9393"
volumes:
# bundle volume for hosting gems installed by bundle; it speeds up gem install in local development
- app_api:/srv/ontoportal/ontologies_api
- .:/srv/ontoportal/ontologies_api
- repository:/srv/ontoportal/data/repository

ncbo_cron:
Expand Down

0 comments on commit fc6635f

Please sign in to comment.