config_server 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0be6fe32a6dfb9d57c1bd3c442df55ce38244a4f
4
- data.tar.gz: 3b4b1f0d22b96bf3e827e575c8ddfd143afabcfc
3
+ metadata.gz: 2583c16164af166f046609b2105bc10fd59970ae
4
+ data.tar.gz: d82db544e9306d3524f9aec546099df1a4c9a2a3
5
5
  SHA512:
6
- metadata.gz: 998cc908d8e2eb17a4524ec87ec14ed47a7e0270d34bc1afbf921e2a2130eedec491f43aa2deaecc616ce1744791962fc2f6672b597c4b226a1a0c4d46c94183
7
- data.tar.gz: 10a96ca9ded60eec7d7b7ca20d1cf65ab2ed4bd99c0a72bd51db4c371649e70bfe65ef47438471bc88e2566c812e5e9afc2e4640b7fcd0e7e3645fc3270eebb1
6
+ metadata.gz: 5b0c0721800b09b6fe0561920c04f028ec9c999c557407430297ed2c155db35eab3ccd99702cb33bbc4b786d8c0f008c00566c2542ecd943e42b68c3f835f303
7
+ data.tar.gz: 38dcd62497811299e18fdac9de58caf3f0d0eb365ad4d7f0e08025a777414dcc3754ebfe9246e67aeedec877d8db4709c66084b7d75d186258e0a5d8a14572d7
data/README.md CHANGED
@@ -1,25 +1,10 @@
1
1
  # ConfigServer
2
2
 
3
- The simplest way to store YAML configuration and serve it over HTTP
3
+ The simplest way to serve configuration over HTTP.
4
+ Currently support YAML files as configuration DB.
4
5
 
5
- ## Installation
6
+ ## Example config.yml
6
7
 
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'config_server'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install config_server
20
-
21
- ## Usage
22
- To run the server you must have a configuration file first:
23
8
  ```yaml
24
9
  #config.yml
25
10
 
@@ -37,6 +22,36 @@ staging:
37
22
  nginx:
38
23
  server_name: www.me.staging
39
24
  ```
25
+
26
+ You have two options for running the server:
27
+
28
+ ## Option 1: Running With Docker
29
+
30
+ ConfigServer has a docker image on Docker Hub. To use it create a config.yml
31
+ file and mount it into the container:
32
+
33
+ $ docker run -d -p 8080:8080 -v /path/to/your/config.yml:/usr/src/app/config.yml nanit/config_server
34
+
35
+ ## Option 2: Running Your Ruby Script
36
+
37
+ ### 1. Install config_server Gem
38
+
39
+ Add this line to your application's Gemfile:
40
+
41
+ ```ruby
42
+ gem 'config_server'
43
+ ```
44
+
45
+ And then execute:
46
+
47
+ $ bundle
48
+
49
+ Or install it yourself as:
50
+
51
+ $ gem install config_server
52
+
53
+ ### 2. Run Your Ruby Script
54
+
40
55
  Then create the following ruby file:
41
56
  ```ruby
42
57
  #my_configuration_server.rb
@@ -46,12 +61,18 @@ require 'config_server'
46
61
  ConfigServer.start("config.yml")
47
62
  ```
48
63
 
49
- and run `bundle exec ruby my_configuration_server.rb`
64
+ Then run:
65
+
66
+ $ bundle exec ruby my_configuration_server.rb
67
+
68
+ ## Querying The Server
50
69
 
51
70
  To get a value just chain the key path as your HTTP request path:
52
- `GET /production/nginx/server_name` to get the corresponding keys.
53
71
 
54
- ## Some More Examples
72
+ `GET /production/nginx/server_name` to get the corresponding keys in your
73
+ config.yml file.
74
+
75
+ Some examples:
55
76
 
56
77
  1. In the first example we get the production db host for the api service
57
78
  2. In the second example we ask for a non existing key and get a 404 response
data/docker/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- config_server (0.1.0)
4
+ config_server (0.1.1)
5
5
  rack
6
6
  rack (1.6.4)
7
7
 
@@ -14,7 +14,7 @@ class ConfigServer::App
14
14
  def call(env)
15
15
  request_path = env['PATH_INFO']
16
16
  @logger.info "Got request for #{request_path}"
17
- value = get_key_from_yaml(request_path)
17
+ value = (request_path == "/ping" && "PONG") || get_key_from_yaml(request_path)
18
18
  if value
19
19
  ['200', {'Content-Type' => 'text/plain'}, [value]]
20
20
  else
@@ -1,3 +1,3 @@
1
1
  module ConfigServer
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erez Rabih
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-11 00:00:00.000000000 Z
11
+ date: 2015-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack