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
f56db126
Commit
f56db126
authored
Mar 16, 2015
by
Seth Vargo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1973 from aneeshusa/clarify-config-discovery-order
Clarify the plugin discovery search & priority orders.
parents
1e43c909
63597af8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
config.go
config.go
+8
-6
No files found.
config.go
View file @
f56db126
...
@@ -49,11 +49,13 @@ func decodeConfig(r io.Reader, c *config) error {
...
@@ -49,11 +49,13 @@ func decodeConfig(r io.Reader, c *config) error {
// Discover discovers plugins.
// Discover discovers plugins.
//
//
// This looks in the directory of the executable and the CWD, in that
// Search the directory of the executable, then the plugins directory, and
// order for priority.
// finally the CWD, in that order. Any conflicts will overwrite previously
// found plugins, in that order.
// Hence, the priority order is the reverse of the search order - i.e., the
// CWD has the highest priority.
func
(
c
*
config
)
Discover
()
error
{
func
(
c
*
config
)
Discover
()
error
{
// Next, look in the same directory as the executable. Any conflicts
// First, look in the same directory as the executable.
// will overwrite those found in our current directory.
exePath
,
err
:=
osext
.
Executable
()
exePath
,
err
:=
osext
.
Executable
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"[ERR] Error loading exe directory: %s"
,
err
)
log
.
Printf
(
"[ERR] Error loading exe directory: %s"
,
err
)
...
@@ -63,7 +65,7 @@ func (c *config) Discover() error {
...
@@ -63,7 +65,7 @@ func (c *config) Discover() error {
}
}
}
}
//
Look in the plugins directory
//
Next, look in the plugins directory.
dir
,
err
:=
ConfigDir
()
dir
,
err
:=
ConfigDir
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"[ERR] Error loading config directory: %s"
,
err
)
log
.
Printf
(
"[ERR] Error loading config directory: %s"
,
err
)
...
@@ -73,7 +75,7 @@ func (c *config) Discover() error {
...
@@ -73,7 +75,7 @@ func (c *config) Discover() error {
}
}
}
}
// L
ook in the cwd
.
// L
ast, look in the CWD
.
if
err
:=
c
.
discover
(
"."
);
err
!=
nil
{
if
err
:=
c
.
discover
(
"."
);
err
!=
nil
{
return
err
return
err
}
}
...
...
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