module WireGuard::Admin::ClassHelpers

Shared class methods

Public Instance Methods

default_network() click to toggle source
# File lib/wire_guard/admin/cli/helpers.rb, line 11
def default_network
  if repository.networks.size == 1
    nw = repository.networks.first
    ENV.fetch('WG_ADMIN_NETWORK', "#{nw}/#{nw.prefix}")
  else
    ENV['WG_ADMIN_NETWORK']
  end
end
path() click to toggle source
# File lib/wire_guard/admin/cli/helpers.rb, line 20
def path
  ENV['WG_ADMIN_STORE'] || File.expand_path('~/.wg-admin.pstore')
end
repository() click to toggle source
# File lib/wire_guard/admin/cli/helpers.rb, line 24
def repository
  @repository ||= Repository.new(path)
end