odania 0.0.31 → 0.0.32

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: c63bc975f8ecf4857321c100a90e59bf2bc7e355
4
- data.tar.gz: 31fcf52e7c496a86261634ce7de3dd88030f7af7
3
+ metadata.gz: b8825d66726c0bd366677b565db4efda65f94781
4
+ data.tar.gz: f0af777d50dd142c6e8abac8c88b5ad9c7f0bbca
5
5
  SHA512:
6
- metadata.gz: 359b130170ad6cb8e356bca18659a58a9c5da3d08a482b07272731bb9b04dd0a2cf58aaa1ba397d6c72cb11c5ebe03318e02cabf9d73c6e7eccaf86d70649cbc
7
- data.tar.gz: 6037c64b9154ff77e3675b18437bc4946cd52b7feaa4b04f4125aef2497979272346d313c5eb469491700e16586fb90f00d8cb015a80bbaa9c0dc243e516beee
6
+ metadata.gz: d68b5ee5db78792eb73574caf0a8aa4a4c31b85584167abe16c62c044a3aff78695e3e7756ab7eb41b9cc048a17df7d2624d2aa4d52dc9c698ad5bd3c127b246
7
+ data.tar.gz: 4bbbc38ab251fb28d5332b3ec9b8ad67439486ecf794410a970fa32d3beecf79c5f1d2c224750aa01a36ee516f0f1cdd53f4b29887ef4321ab7acccbfc8cc1e6
@@ -1,3 +1,3 @@
1
1
  module Odania
2
- VERSION = '0.0.31'
2
+ VERSION = '0.0.32'
3
3
  end
data/lib/odania.rb CHANGED
@@ -33,6 +33,11 @@ module Odania
33
33
  @varnish
34
34
  end
35
35
 
36
+ def self.consul
37
+ Odania.configure
38
+ @consul
39
+ end
40
+
36
41
  def self.configure(consul_url=nil)
37
42
  @consul = Consul.new(consul_url) if @consul.nil?
38
43
  $debug = false
@@ -39,6 +39,25 @@
39
39
  }
40
40
  },
41
41
  "example.com": {
42
+
43
+ "_general": {
44
+ "config": {
45
+
46
+ },
47
+ "data": {
48
+ "external": {
49
+
50
+ },
51
+ "internal": {
52
+
53
+ },
54
+ "assets": {
55
+
56
+ }
57
+ }
58
+ },
59
+
60
+
42
61
  "_general": {
43
62
  "config": {
44
63
  },
@@ -9,7 +9,7 @@ sub vcl_recv {
9
9
 
10
10
  <% general_subdomain.assets.each_pair do |url, page| %>
11
11
  if (req.url ~ "^<%= prepare_url url %>") {
12
- std.log("page identified '<%= subdomain.name %>.<%= domain.name %>' Page:'<%= url %>':" + req.url);
12
+ std.log("asset identified '<%= domain.name %>' Page:'<%= url %>':" + req.url);
13
13
 
14
14
  set req.backend_hint = <%= page.director %>.backend();
15
15
  <% unless page.plugin_url.nil? %>set req.url = "<%= page.plugin_url %>";<% end %>
@@ -10,6 +10,34 @@ sub vcl_recv {
10
10
  if (req.http.host ~ "<%= domain.name %>$") {
11
11
  std.log("varnish log info '<%= domain.name %>':" + req.http.host);
12
12
 
13
+ # General part
14
+ <% domain.get_redirects.each_pair do |src, target| %>
15
+ if (req.url ~ "<%= src %>") {
16
+ std.log("general redirect identified '<%= domain.name %>' src:'<%= src %>':" + req.url);
17
+ set req.http.Location = "<%= target %>";
18
+ return (synth(750, "Permanently moved"));
19
+ }
20
+ <% end %>
21
+
22
+ <% subdomain = domain.subdomains['_general'] %>
23
+ <% %w(direct dynamic).each do |type| %>
24
+ <% subdomain[type].each_pair do |url, page| %>
25
+ if (req.url ~ "^<%= prepare_url url %>") {
26
+ std.log("page identified '<%= subdomain.name %>.<%= domain.name %>' Page:'<%= url %>':" + req.url);
27
+
28
+ <% if 'direct'.eql? type %>
29
+ set req.backend_hint = <%= page.director %>.backend();
30
+ <% unless page.plugin_url.nil? %>set req.url = "<%= page.plugin_url %>";<% end %>
31
+ <% else %>
32
+ set req.backend_hint = core_backend_director.backend();
33
+ set req.url = "/template/page?req_url=" + req.url + "&req_host=" + req.http.host + "<%= template_url_for(domain, page) %>";
34
+ <% end %>
35
+
36
+ return (hash);
37
+ }
38
+ <% end %>
39
+ <% end %>
40
+
13
41
  <% domain.subdomains.each_pair do |subdomain_name, subdomain|
14
42
  next if '_general'.eql? subdomain_name %>
15
43
  <%= is_first ? '' : 'else ' %>if (req.http.host ~ "^<%= subdomain.name %>.<%= domain.name %>$") {
@@ -41,6 +69,9 @@ sub vcl_recv {
41
69
  }
42
70
  <% end %>
43
71
 
72
+ set req.backend_hint = core_backend_director.backend();
73
+ set req.url = "/base/identify?req_url=" + req.url + "&req_host=" + req.http.host + "&domain=<%= domain.name %>";
74
+ return (hash);
44
75
  }
45
76
  <% is_first = false %>
46
77
  <% end %>
@@ -52,34 +83,6 @@ sub vcl_recv {
52
83
  set req.http.Location = "http://<%= default_subdomain_for(domain) %>.<%= domain.name %>" + req.url;
53
84
  return (synth(750, "Permanently moved"));
54
85
  }
55
-
56
- # General part
57
- <% domain.get_redirects.each_pair do |src, target| %>
58
- if (req.url ~ "<%= src %>") {
59
- std.log("general redirect identified '<%= domain.name %>' src:'<%= src %>':" + req.url);
60
- set req.http.Location = "<%= target %>";
61
- return (synth(750, "Permanently moved"));
62
- }
63
- <% end %>
64
-
65
- <% subdomain = domain.subdomains['_general'] %>
66
- <% %w(direct dynamic).each do |type| %>
67
- <% subdomain[type].each_pair do |url, page| %>
68
- if (req.url ~ "^<%= prepare_url url %>") {
69
- std.log("page identified '<%= subdomain.name %>.<%= domain.name %>' Page:'<%= url %>':" + req.url);
70
-
71
- <% if 'direct'.eql? type %>
72
- set req.backend_hint = <%= page.director %>.backend();
73
- <% unless page.plugin_url.nil? %>set req.url = "<%= page.plugin_url %>";<% end %>
74
- <% else %>
75
- set req.backend_hint = core_backend_director.backend();
76
- set req.url = "/template/page?req_url=" + req.url + "&req_host=" + req.http.host + "<%= template_url_for(domain, page) %>";
77
- <% end %>
78
-
79
- return (hash);
80
- }
81
- <% end %>
82
- <% end %>
83
86
  }
84
87
  }
85
88
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odania
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.31
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Petersen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-11 00:00:00.000000000 Z
11
+ date: 2016-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler