Class: Identizer::Handlers::Settings

Inherits:
Base
  • Object
show all
Defined in:
lib/identizer/handlers/settings.rb

Overview

View and edit runtime settings (shared password, token signing), persisted to settings.json so the standalone server picks them up on the next boot.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Responses

#amz_json, #escape_html, #html, #json, #no_content, #not_found, #notice_page, #redirect, #xml

Constructor Details

This class inherits a constructor from Identizer::Handlers::Base

Instance Method Details

#show(request) ⇒ Object



8
9
10
# File 'lib/identizer/handlers/settings.rb', line 8

def show(request)
  page("settings/index", request, nav: :settings, title: "Settings", config: config)
end

#update(request) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/identizer/handlers/settings.rb', line 12

def update(request)
  password = request.params["shared_password"].to_s
  config.shared_password = password unless password.empty?
  config.signing = request.params["signing"] == "rs256" ? :rs256 : :hs256
  config.persist_settings!

  redirect("#{request.script_name}/settings")
end