credentialias-helper 0.1.0
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 +7 -0
- data/.gitignore +9 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +5 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/bin/console +7 -0
- data/bin/setup +7 -0
- data/credentialias-helper.gemspec +28 -0
- data/hap.cfg +30 -0
- data/lib/credentialias/helper/agent.rb +14 -0
- data/lib/credentialias/helper/api.rb +23 -0
- data/lib/credentialias/helper/config.rb +23 -0
- data/lib/credentialias/helper/credential.rb +11 -0
- data/lib/credentialias/helper/server.rb +37 -0
- data/lib/credentialias/helper/version.rb +5 -0
- data/lib/credentialias/helper.rb +8 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bc76e6926c7b56ca52ca9de2d051a64f14eadc15
|
4
|
+
data.tar.gz: e8b98962a206e96bf7762b54ac27e49edf454d93
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 45003fac20653ba4be9aed56440a379b1245ca6b74d067942edc7569f4215caecb33543d4ae30cc2e4248188e90e0ba996d0c734551c707eb70d741ecbeb9718
|
7
|
+
data.tar.gz: 607949450e2c1f8c6e00a02fb725f30906ccc1f486ede51f2407f35199c3a18ee49c5c19e8e5403ddbde667322cdca07ead202fd1f40473c9acc2a7dbb2024ad
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
credentialias-helper
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.2.2
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Credentialias::Helper
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/credentialias/helper`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'credentialias-helper'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install credentialias-helper
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/credentialias-helper/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'credentialias/helper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "credentialias-helper"
|
8
|
+
spec.version = Credentialias::Helper::VERSION
|
9
|
+
spec.authors = ["Mathias Kaufmann"]
|
10
|
+
spec.email = ["me@stei.gr"]
|
11
|
+
|
12
|
+
spec.summary = %q{Utility Gem to query Credentialias Webservice.}
|
13
|
+
spec.description = %q{Utility Gem to query Credentialias Webservice.}
|
14
|
+
spec.homepage = "https://credentialias.stei.gr"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "boutons"
|
22
|
+
spec.add_dependency "unirest"
|
23
|
+
spec.add_dependency "addressable"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
end
|
data/hap.cfg
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# auto-generated by synapse at 2015-04-27 23:49:12 +0200
|
2
|
+
|
3
|
+
global
|
4
|
+
daemon
|
5
|
+
log 127.0.0.1:11514 local0
|
6
|
+
maxconn 4096
|
7
|
+
stats socket /tmp/5b7fbe.sock mode 600 level admin
|
8
|
+
defaults
|
9
|
+
option dontlognull
|
10
|
+
option redispatch
|
11
|
+
option tcpka
|
12
|
+
log global
|
13
|
+
maxconn 2048
|
14
|
+
retries 3
|
15
|
+
balance roundrobin
|
16
|
+
timeout connect 50000
|
17
|
+
timeout client 72000000
|
18
|
+
timeout server 72000000
|
19
|
+
timeout queue 60000
|
20
|
+
timeout check 10000
|
21
|
+
|
22
|
+
frontend api
|
23
|
+
mode http
|
24
|
+
bind localhost:8788
|
25
|
+
default_backend api
|
26
|
+
|
27
|
+
backend api
|
28
|
+
mode http
|
29
|
+
option httpchk GET /health
|
30
|
+
server localhost:3000_credentialias localhost:3000 cookie localhost:3000_credentialias check inter 2000 rise 2 fall 3
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "credentialias/helper/server"
|
2
|
+
require "credentialias/helper/api"
|
3
|
+
|
4
|
+
module Credentialias
|
5
|
+
module Helper
|
6
|
+
module Agent
|
7
|
+
def load service,token:ENV['CREDENTIALIAS'],tags:[]
|
8
|
+
Server.connect
|
9
|
+
Api.use token
|
10
|
+
Api.request service, tags
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "credentialias/helper/server"
|
2
|
+
require "credentialias/helper/credential"
|
3
|
+
require "unirest"
|
4
|
+
require "addressable/uri"
|
5
|
+
|
6
|
+
module Credentialias
|
7
|
+
module Helper
|
8
|
+
module Api
|
9
|
+
class << self
|
10
|
+
def use token
|
11
|
+
@token = token
|
12
|
+
Unirest.default_header('X-Credentialias-Token',@token)
|
13
|
+
end
|
14
|
+
def request service, tags
|
15
|
+
au = Addressable::URI.new
|
16
|
+
au.query_values={tags:tags} unless tags.empty?
|
17
|
+
au = au.query ? "?#{au.query}" : ""
|
18
|
+
Credential.new Server.get("/api/application/#{service}#{au}").body["credential"]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "boutons"
|
2
|
+
|
3
|
+
module Credentialias
|
4
|
+
module Helper
|
5
|
+
class Config
|
6
|
+
API_VERSION = 1
|
7
|
+
class << self
|
8
|
+
def config
|
9
|
+
{
|
10
|
+
"services" => {
|
11
|
+
"api" => [
|
12
|
+
"zookeeper+http:///nerve/credentialias/api#/health"
|
13
|
+
]
|
14
|
+
}
|
15
|
+
}
|
16
|
+
end
|
17
|
+
def configure
|
18
|
+
Boutons::Config.config(config)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "boutons"
|
2
|
+
require "unirest"
|
3
|
+
require "credentialias/helper/config"
|
4
|
+
|
5
|
+
module Credentialias
|
6
|
+
module Helper
|
7
|
+
module Server
|
8
|
+
class << self
|
9
|
+
def connect
|
10
|
+
Config.configure
|
11
|
+
Boutons.api
|
12
|
+
Unirest.default_header('X-Credentialias-API',Credentialias::Helper::Config::API_VERSION)
|
13
|
+
Unirest.default_header('Accept','application/json')
|
14
|
+
Unirest.default_header('Content-Type','application/json')
|
15
|
+
end
|
16
|
+
def backend
|
17
|
+
@backend ||= Boutons.api
|
18
|
+
end
|
19
|
+
def get path
|
20
|
+
Unirest.get url path
|
21
|
+
end
|
22
|
+
def delete path
|
23
|
+
Unirest.delete url(path)
|
24
|
+
end
|
25
|
+
def post path, parameters
|
26
|
+
Unirest.post url(path), parameters: parameters
|
27
|
+
end
|
28
|
+
def put path, parameters
|
29
|
+
Unirest.put url(path), parameters: parameters
|
30
|
+
end
|
31
|
+
def url path
|
32
|
+
backend.s("%P://%h:%p#{path}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: credentialias-helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mathias Kaufmann
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: boutons
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: unirest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: addressable
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Utility Gem to query Credentialias Webservice.
|
98
|
+
email:
|
99
|
+
- me@stei.gr
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".ruby-gemset"
|
106
|
+
- ".ruby-version"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- bin/console
|
112
|
+
- bin/setup
|
113
|
+
- credentialias-helper.gemspec
|
114
|
+
- hap.cfg
|
115
|
+
- lib/credentialias/helper.rb
|
116
|
+
- lib/credentialias/helper/agent.rb
|
117
|
+
- lib/credentialias/helper/api.rb
|
118
|
+
- lib/credentialias/helper/config.rb
|
119
|
+
- lib/credentialias/helper/credential.rb
|
120
|
+
- lib/credentialias/helper/server.rb
|
121
|
+
- lib/credentialias/helper/version.rb
|
122
|
+
homepage: https://credentialias.stei.gr
|
123
|
+
licenses: []
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.4.6
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: Utility Gem to query Credentialias Webservice.
|
145
|
+
test_files: []
|