Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VietTH-VenShop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tran Hoang Viet
VietTH-VenShop
Commits
5ffe9a18
Commit
5ffe9a18
authored
Jul 24, 2015
by
Tran Hoang Viet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VietTH: Add authenticate to solr admin
parent
b04d8363
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
0 deletions
+27
-0
app/models/concerns/rsolr_authenticate.rb
+16
-0
app/models/concerns/solr.rb
+4
-0
config/application.rb
+4
-0
config/application.yml
+3
-0
No files found.
app/models/concerns/rsolr_authenticate.rb
0 → 100644
View file @
5ffe9a18
module
RsolrAuthenticate
require
'rsolr/connection'
class
RSolr
::
Connection
protected
def
setup_raw_request_with_basic_auth
request_context
raw_request
=
setup_raw_request_without_basic_auth
(
request_context
)
raw_request
.
basic_auth
(
ENV
[
'SOLR_USER'
],
ENV
[
'SOLR_PWD'
])
raw_request
end
alias_method
:setup_raw_request_without_basic_auth
,
:setup_raw_request
alias_method
:setup_raw_request
,
:setup_raw_request_with_basic_auth
end
end
\ No newline at end of file
app/models/concerns/solr.rb
View file @
5ffe9a18
module
Solr
extend
ActiveSupport
::
Concern
module
Solr
extend
ActiveSupport
::
Concern
include
RsolrAuthenticate
included
do
included
do
after_save
:push_data_to_solr
after_save
:push_data_to_solr
after_destroy
:remove_from_solr
after_destroy
:remove_from_solr
...
@@ -75,6 +78,7 @@ module Solr extend ActiveSupport::Concern
...
@@ -75,6 +78,7 @@ module Solr extend ActiveSupport::Concern
end
end
def
rsolr
def
rsolr
@rsolr_service
||=
RSolr
.
connect
(
url:
Settings
.
solr_url
)
@rsolr_service
||=
RSolr
.
connect
(
url:
Settings
.
solr_url
)
end
end
...
...
config/application.rb
View file @
5ffe9a18
...
@@ -26,5 +26,9 @@ module VenShop
...
@@ -26,5 +26,9 @@ module VenShop
config
.
active_job
.
queue_adapter
=
:sidekiq
config
.
active_job
.
queue_adapter
=
:sidekiq
config
.
autoload_paths
+=
Dir
[
"
#{
config
.
root
}
/app/services/**/*.rb"
]
config
.
autoload_paths
+=
Dir
[
"
#{
config
.
root
}
/app/services/**/*.rb"
]
console
do
ActiveRecord
::
Base
.
logger
=
Rails
.
logger
=
Logger
.
new
(
STDOUT
)
end
end
end
end
end
config/application.yml
View file @
5ffe9a18
...
@@ -9,3 +9,5 @@ S3_SECRET: WzHwCJowOJoZGQ9DbHWvzdVhYtpOrDpuynEiK4YL
...
@@ -9,3 +9,5 @@ S3_SECRET: WzHwCJowOJoZGQ9DbHWvzdVhYtpOrDpuynEiK4YL
FB_APP_ID
:
1629224294024346
FB_APP_ID
:
1629224294024346
SOLR_URL
:
http://localhost:8080/solr/venshop
SOLR_URL
:
http://localhost:8080/solr/venshop
SOLR_USER
:
admin
SOLR_PWD
:
123456
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment