mirror of
https://github.com/inspec/inspec
synced 2025-02-16 22:18:38 +00:00
Change usage of Dir.home
to Inspec.config_dir
(#3567)
This prevents errors on systems without `ENV['HOME']` (e.g. Habitat services) by allowing the specification of the location of `.inspec` via `ENV['INSPEC_CONFIG_DIR']`. Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
This commit is contained in:
parent
10e5292e27
commit
701dd9fb0b
2 changed files with 2 additions and 2 deletions
|
@ -34,7 +34,7 @@ module Inspec
|
|||
@paths += Dir[lib_home+'/inspec-*-*/lib/inspec-*rb']
|
||||
|
||||
# traverse out of inspec-vX.Y.Z/lib/inspec/plugins.rb
|
||||
@home = home || File.join(Dir.home, '.inspec', 'plugins')
|
||||
@home = home || File.join(Inspec.config_dir, 'plugins')
|
||||
@paths += Dir[File.join(@home, '**{,/*/**}', '*.gemspec')]
|
||||
.map { |x| File.dirname(x) }
|
||||
.map { |x| Dir[File.join(x, 'lib', 'inspec-*.rb')] }
|
||||
|
|
|
@ -5,7 +5,7 @@ module InspecPlugins
|
|||
# stores configuration on local filesystem
|
||||
class Configuration
|
||||
def initialize
|
||||
@config_path = File.join(Dir.home, '.inspec', 'compliance')
|
||||
@config_path = File.join(Inspec.config_dir, 'compliance')
|
||||
# ensure the directory is available
|
||||
unless File.directory?(@config_path)
|
||||
FileUtils.mkdir_p(@config_path)
|
||||
|
|
Loading…
Add table
Reference in a new issue