Sha256: 710df5112a04deb3b94570ea5deef590b4d41a37a200421f9b60f5b3e2053b91
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
# # Copyright 2019 Ken Spencer / IotaSpencer # # # File: ${FILENAME} # Created: 3/14/19 # # License is in project root, MIT License is in use. require 'cloudflare_client' require 'configparser' require 'pathname' require 'public_suffix' module Certflare class CleanUp def initialize @configs_dir = Pathname.new('/etc/') @cfg = ConfigParser.new(@configs_dir.join('certflare')) @api_key = @cfg['dns_cloudflare_api_key'] @email = @cfg['dns_cloudflare_email'] @client = CloudflareClient::Zone.new(auth_key: @api_key, email: @email) end def get_certbot_vars @domain = ENV['CERTBOT_DOMAIN'] @validation = ENV['CERTBOT_VALIDATION'] end def get_domain domain = ENV['CERTBOT_DOMAIN'] @full_domain = domain @main_domain = PublicSuffix.domain(domain) end def remove_zone_id @domain_dir = Pathname.new("/sites/tmp/CERTBOT_#{@domain}") if @domain_dir.join('ZONE_ID').exist? @zone_id = File.read(@domain_dir.join('ZONE_ID').to_s) File.delete(@domain_dir.join('ZONE_ID').to_s) end end def remove_record_id if @domain_dir.join('RECORD_ID').exist? @record_id = File.read(@domain_dir.join('RECORD_ID').to_s) File.delete(@domain_dir.join('RECORD_ID').to_s) end end def remove_txt_record unless (defined?(@zone_id)).nil? unless (defined?(@record_id)).nil? zone = CloudflareClient::Zone::DNS.new(auth_key: @api_key, email: @email, zone_id: @zone_id) zone.delete(id: @record_id) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
certflare-0.1.8 | lib/certflare/common/cleanup.rb |