Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
25868e1a
Commit
25868e1a
authored
Sep 08, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ConfigDir
parent
5afcac3f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
14 deletions
+28
-14
config.go
config.go
+28
-5
config_unix.go
config_unix.go
+0
-0
config_windows.go
config_windows.go
+0
-0
configfile.go
configfile.go
+0
-9
No files found.
config.go
View file @
25868e1a
...
@@ -23,6 +23,19 @@ type config struct {
...
@@ -23,6 +23,19 @@ type config struct {
Provisioners
map
[
string
]
string
Provisioners
map
[
string
]
string
}
}
// ConfigFile returns the default path to the configuration file. On
// Unix-like systems this is the ".packerconfig" file in the home directory.
// On Windows, this is the "packer.config" file in the application data
// directory.
func
ConfigFile
()
(
string
,
error
)
{
return
configFile
()
}
// ConfigDir returns the configuration directory for Packer.
func
ConfigDir
()
(
string
,
error
)
{
return
configDir
()
}
// Decodes configuration in JSON format from the given io.Reader into
// Decodes configuration in JSON format from the given io.Reader into
// the config object pointed to.
// the config object pointed to.
func
decodeConfig
(
r
io
.
Reader
,
c
*
config
)
error
{
func
decodeConfig
(
r
io
.
Reader
,
c
*
config
)
error
{
...
@@ -35,11 +48,6 @@ func decodeConfig(r io.Reader, c *config) error {
...
@@ -35,11 +48,6 @@ func decodeConfig(r io.Reader, c *config) error {
// This looks in the directory of the executable and the CWD, in that
// This looks in the directory of the executable and the CWD, in that
// order for priority.
// order for priority.
func
(
c
*
config
)
Discover
()
error
{
func
(
c
*
config
)
Discover
()
error
{
// Look in the cwd.
if
err
:=
c
.
discover
(
"."
);
err
!=
nil
{
return
err
}
// Next, look in the same directory as the executable. Any conflicts
// Next, look in the same directory as the executable. Any conflicts
// will overwrite those found in our current directory.
// will overwrite those found in our current directory.
exePath
,
err
:=
osext
.
Executable
()
exePath
,
err
:=
osext
.
Executable
()
...
@@ -51,6 +59,21 @@ func (c *config) Discover() error {
...
@@ -51,6 +59,21 @@ func (c *config) Discover() error {
}
}
}
}
// Look in the plugins directory
dir
,
err
:=
ConfigDir
()
if
err
!=
nil
{
log
.
Printf
(
"[ERR] Error loading config directory: %s"
,
err
)
}
else
{
if
err
:=
c
.
discover
(
filepath
.
Join
(
dir
,
"plugins"
));
err
!=
nil
{
return
err
}
}
// Look in the cwd.
if
err
:=
c
.
discover
(
"."
);
err
!=
nil
{
return
err
}
return
nil
return
nil
}
}
...
...
config
file
_unix.go
→
config_unix.go
View file @
25868e1a
File moved
config
file
_windows.go
→
config_windows.go
View file @
25868e1a
File moved
configfile.go
deleted
100644 → 0
View file @
5afcac3f
package
main
// ConfigFile returns the default path to the configuration file. On
// Unix-like systems this is the ".packerconfig" file in the home directory.
// On Windows, this is the "packer.config" file in the application data
// directory.
func
ConfigFile
()
(
string
,
error
)
{
return
configFile
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment