ts-admin 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3068ade8215ebae2e713dd66121329a63d3e1450
4
- data.tar.gz: 574a719ab77ecf0c8cd59a5ada99834a4d730c5e
3
+ metadata.gz: 528db841c6ef8e98947079034726aa5a4ce3214b
4
+ data.tar.gz: 5fe471e105e13a03729202b24991bd301c357825
5
5
  SHA512:
6
- metadata.gz: 76a48e77f48113002c5ae98f7e3b053c971b41795b8cb20757a5a8bb06fe5f2de9b58c125eb73efcc2706a051a07aab9b5be4c1ed9d37985ffef02db39ba7bdb
7
- data.tar.gz: 1bd74737065d1146b5c6eea3930fc6e32f3f9ccceb3eb55b0378d421c6bd7c98e220091602e6be5b79892c7bdf3c02dd530eabc0c60c024160996392e0e85f09
6
+ metadata.gz: 68fd21ece886a89189657474545b41a7098164e946bae268d82a6a848f8d32884186b368e6118bf1481979dbce20257bdfef2ae96d958454a4dd32a89ff2b037
7
+ data.tar.gz: c1ad67697964dc72e52e1c0d558f203fef5d92c001e9b6a69e8218034c1a57dfcad6dbf136f0004768b352dfaeb9cfd50a9859ec810ad085b3ae76cfba473564
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ts-admin (0.2.2)
4
+ ts-admin (0.2.3)
5
5
  ramaze (>= 2.0.0)
6
6
 
7
7
  GEM
data/app.yml.example CHANGED
@@ -1,8 +1,9 @@
1
1
  port: 7000
2
2
 
3
3
  auth:
4
- username: admin
5
- password: d033e22ae348aeb5660fc2140aec35850c4da997 # SHA1 hash
4
+ -
5
+ username: admin
6
+ password: d033e22ae348aeb5660fc2140aec35850c4da997 # SHA1 hash
6
7
 
7
8
  traffic_server:
8
9
  config_path: /etc/trafficserver
data/bin/ts-admin CHANGED
@@ -10,6 +10,9 @@ OptionParser.new do |opts|
10
10
  opts.on("-c", "--config [path]", "Port") do |config|
11
11
  OPTIONS[:config] = config
12
12
  end
13
+ opts.on("--ip [ip]", "IP") do |ip|
14
+ OPTIONS[:ip] = ip
15
+ end
13
16
  opts.on("-p", "--port [port]", "Port") do |port|
14
17
  OPTIONS[:port] = port.to_i
15
18
  end
@@ -20,6 +23,7 @@ require File.expand_path('../../app', __FILE__)
20
23
 
21
24
  Ramaze.start(
22
25
  :adapter => :webrick,
26
+ :host => OPTIONS[:ip] || APP_CONFIG['ip'] || nil,
23
27
  :port => OPTIONS[:port] || APP_CONFIG['port'] || 7000,
24
28
  :file => __FILE__,
25
29
  :root => Ramaze.options.roots
data/controller/init.rb CHANGED
@@ -30,11 +30,18 @@ class Controller < Ramaze::Controller
30
30
  return unless username and password
31
31
  return if username.empty? or password.empty?
32
32
 
33
- return unless APP_CONFIG['auth']['username'].downcase == username.downcase
34
- return unless APP_CONFIG['auth']['password'] == Digest::SHA1.hexdigest(password)
33
+ authenticated = false
34
+ auth = APP_CONFIG['auth'].is_a?(Array) ? APP_CONFIG['auth'] : [APP_CONFIG['auth']]
35
+ auth.each do |a|
36
+ next unless a['username'].downcase == username.downcase
37
+ next unless a['password'] == Digest::SHA1.hexdigest(password)
38
+ authenticated = true
39
+ end
40
+
41
+ return unless authenticated
35
42
 
36
43
  session[:logged_in] = true
37
- session[:username] = APP_CONFIG['auth']['username']
44
+ session[:username] = username.downcase
38
45
  end
39
46
 
40
47
  def login_required
@@ -1,3 +1,3 @@
1
1
  module TSAdmin
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-31 00:00:00.000000000 Z
11
+ date: 2013-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler