* make desk keys configurable
This commit is contained in:
parent
c11ae11c99
commit
ea601711fa
|
|
@ -0,0 +1,2 @@
|
|||
-- this is to make sure we don't delete any recordings for 7 days
|
||||
UPDATE recordings SET updated_at = NOW();
|
||||
|
|
@ -11,9 +11,6 @@ module JamRuby
|
|||
# https://github.com/assistly/multipass-examples/blob/master/ruby.rb
|
||||
class DeskMultipass
|
||||
|
||||
API_KEY = "453ddfc0bab00130a9c13bc9a68cf24c"
|
||||
SITE_KEY = "jamkazam"
|
||||
|
||||
def initialize(user)
|
||||
@user = user
|
||||
generate_token_and_signature
|
||||
|
|
@ -29,7 +26,7 @@ module JamRuby
|
|||
|
||||
private
|
||||
def generate_token_and_signature
|
||||
key = Digest::SHA1.digest(API_KEY + SITE_KEY)[0...16]
|
||||
key = Digest::SHA1.digest(APP_CONFIG.desk_multipass_key + APP_CONFIG.desk_multipass_site)[0...16]
|
||||
|
||||
# Generate a random 16 byte IV
|
||||
iv = OpenSSL::Random.random_bytes(16)
|
||||
|
|
@ -48,7 +45,7 @@ module JamRuby
|
|||
|
||||
prepended = iv + encrypted
|
||||
token = Base64.encode64(prepended)
|
||||
signature = Base64.encode64(OpenSSL::HMAC.digest('sha1', API_KEY, token))
|
||||
signature = Base64.encode64(OpenSSL::HMAC.digest('sha1', APP_CONFIG.desk_multipass_key, token))
|
||||
|
||||
@token = CGI.escape(token)
|
||||
@signature = CGI.escape(signature)
|
||||
|
|
|
|||
|
|
@ -152,6 +152,9 @@ if defined?(Bundler)
|
|||
config.multipass_callback_url = "http://jamkazam.desk.com/customer/authentication/multipass/callback"
|
||||
end
|
||||
|
||||
config.desk_multipass_key = "453ddfc0bab00130a9c13bc9a68cf24c" # found in https://jamkazam.desk.com/admin/channels/support-center/auth_settings
|
||||
config.desk_multipass_site = "jamkazam" # found in https://jamkazam.desk.com/admin/channels/support-center/auth_settings
|
||||
|
||||
# perf_data configs
|
||||
config.perf_data_signed_url_timeout = 3600 * 24 # 1 day
|
||||
|
||||
|
|
@ -273,5 +276,7 @@ if defined?(Bundler)
|
|||
config.scoring_timeout_threshold = 5 # how many consequetive bad scores before you are put into the doghouse
|
||||
config.scoring_get_work_interval = 1000 # how much time between normal getwork requests
|
||||
config.scoring_get_work_backoff_interval = 60 * 1000 # how much time between failed getwork requests
|
||||
|
||||
config.recordings_stale_time = 3 # num days of inactivity before we decide that a recording is no longer going to be claimed
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue