mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2025-01-22 05:28:00 +01:00
use SHARED_IMPORT_SECRET
This commit is contained in:
parent
19c29ef021
commit
ac5350c461
6 changed files with 12 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,7 +14,6 @@
|
||||||
# Ignore all logfiles and tempfiles.
|
# Ignore all logfiles and tempfiles.
|
||||||
/log/*.log
|
/log/*.log
|
||||||
/tmp
|
/tmp
|
||||||
config/morph.yml
|
|
||||||
/coverage
|
/coverage
|
||||||
.vagrant
|
.vagrant
|
||||||
/node_modules
|
/node_modules
|
||||||
|
|
|
@ -4,14 +4,21 @@ class ImportController < ApplicationController
|
||||||
skip_before_action :verify_authenticity_token, only: [:new_papers_callback]
|
skip_before_action :verify_authenticity_token, only: [:new_papers_callback]
|
||||||
|
|
||||||
def new_papers_callback
|
def new_papers_callback
|
||||||
|
received_secret = params[:secret]
|
||||||
|
expected_secret = Rails.application.config.shared_import_secret
|
||||||
|
if received_secret != expected_secret
|
||||||
|
print("secrets not match")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
#api_key = Rails.application.config_for(:morph)['key']
|
#api_key = Rails.application.config_for(:morph)['key']
|
||||||
#uri = URI.parse("https://api.morph.io/jrlover/city_council_leipzig_recent_papers/data.json?key=#{api_key}&query=select%20*%20from%20%27data%27")
|
#uri = URI.parse("https://api.morph.io/jrlover/city_council_leipzig_recent_papers/data.json?key=#{api_key}&query=select%20*%20from%20%27data%27")
|
||||||
print("before parse")
|
print("before parse")
|
||||||
uri = URI.parse("https://joergreichert.de/srm/input.json")
|
uri = URI.parse("https://joergreichert.de/srm/input.json")
|
||||||
print("after parse")
|
print("after parse")
|
||||||
#Paper.import_from_json(uri.read)
|
Paper.import_from_json(uri.read)
|
||||||
print("after import")
|
print("after import")
|
||||||
render nothing: true
|
head :no_content
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,4 +41,5 @@ Rails.application.configure do
|
||||||
$stdout.sync = true
|
$stdout.sync = true
|
||||||
|
|
||||||
config.hosts = ENV['APPLICATION_HOST'] || 'localhost'
|
config.hosts = ENV['APPLICATION_HOST'] || 'localhost'
|
||||||
|
config.shared_import_secret = ENV['SHARED_IMPORT_SECRET']
|
||||||
end
|
end
|
||||||
|
|
|
@ -77,4 +77,5 @@ Rails.application.configure do
|
||||||
config.active_record.dump_schema_after_migration = false
|
config.active_record.dump_schema_after_migration = false
|
||||||
|
|
||||||
config.hosts = ENV['APPLICATION_HOST'] || 'stadtratmonitor.leipzig.codefor.de'
|
config.hosts = ENV['APPLICATION_HOST'] || 'stadtratmonitor.leipzig.codefor.de'
|
||||||
|
config.shared_import_secret = ENV['SHARED_IMPORT_SECRET']
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
development:
|
|
||||||
key: insertyourkeyhere
|
|
|
@ -12,6 +12,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- ELASTICSEARCH_URL=http://elasticsearch:9200
|
- ELASTICSEARCH_URL=http://elasticsearch:9200
|
||||||
- APPLICATION_HOST=$APPLICATION_HOST
|
- APPLICATION_HOST=$APPLICATION_HOST
|
||||||
|
- SHARED_IMPORT_SECRET=$SHARED_IMPORT_SECRET
|
||||||
command: sh -c "cd /home/srm/app && bundle exec puma -C config/puma.rb"
|
command: sh -c "cd /home/srm/app && bundle exec puma -C config/puma.rb"
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
user: elasticsearch
|
user: elasticsearch
|
||||||
|
|
Loading…
Reference in a new issue