save
This commit is contained in:
parent
76bd8f782d
commit
f7d2665d4f
6 changed files with 27 additions and 11 deletions
|
@ -7,6 +7,7 @@ require 'fileutils'
|
|||
require 'open3'
|
||||
|
||||
# make for: the user, system, package
|
||||
# user/usr, system/sys, package/pkg
|
||||
|
||||
# as regular user, if dependencies provided
|
||||
# user: $HOME/.local
|
||||
|
|
|
@ -3,7 +3,12 @@ require 'erb'
|
|||
|
||||
class NGINXProxy
|
||||
class << self
|
||||
attr_accessor :domain, :port, :service, :user
|
||||
attr_accessor :domain, :port, :service, :user, :willcard
|
||||
|
||||
def willcard(value = nil)
|
||||
@willcard = value unless value.nil?
|
||||
@willcard
|
||||
end
|
||||
|
||||
def domain(value = nil)
|
||||
@domain = value unless value.nil?
|
||||
|
@ -27,8 +32,11 @@ class NGINXProxy
|
|||
@service
|
||||
end
|
||||
|
||||
## bundle exec rackup -s puma -b unix:///run/user/1000/http.sock
|
||||
|
||||
def generate
|
||||
template = File.read("proxy.erb")
|
||||
template_path = File.join(__dir__, 'data', 'templates', 'nginx', 'proxy.erb')
|
||||
template = File.read(template_path)
|
||||
template = ERB.new(template)
|
||||
template.result(binding)
|
||||
end
|
||||
|
@ -48,12 +56,3 @@ class NGINXProxy
|
|||
end
|
||||
end
|
||||
|
||||
class ExampleProxy < NGINXProxy
|
||||
domain "gurgul.org"
|
||||
service "forgejo"
|
||||
user "git"
|
||||
port 3000
|
||||
end
|
||||
|
||||
puts ExampleProxy.generate
|
||||
puts ExampleProxy.path
|
5
lib/user.rb
Normal file
5
lib/user.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
module User
|
||||
|
||||
|
||||
end
|
11
recipes/example-roda.rb
Normal file
11
recipes/example-roda.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require 'nginx'
|
||||
|
||||
class ExampleProxy < NGINXProxy
|
||||
domain "gurgul.org"
|
||||
service "forgejo"
|
||||
user "git"
|
||||
port 3000
|
||||
end
|
||||
|
||||
puts ExampleProxy.generate
|
||||
puts ExampleProxy.available_path
|
Loading…
Add table
Add a link
Reference in a new issue