# # Cookbook:: esh_go_mmproxy # Recipe:: default # # Copyright:: 2023, https://easyself.host # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. package 'golang' execute 'set GOBIN path' do command 'go env -w GOBIN=/usr/local/bin' not_if 'go env | grep GOBIN=\"/usr/local/bin\"' action :run end execute 'install go-mmproxy' do command 'go install github.com/path-network/go-mmproxy@2.1' not_if { ::File.exist?('/usr/local/bin/go-mmproxy') } action :run end file '/usr/share/path-prefixes.txt' do content node['esh']['go_mmproxy']['prefixes'] owner 'root' group 'root' mode '0644' action :create end node['esh']['go_mmproxy']['proxies'].each do |to, listen| esh_go_mmproxy_service to do listen listen end end