forked from osbuild/bootc-image-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buildconfig: support passing build config via
stdin
This commit adds support for reading the build config via stdin. To do that the `-config` switch now supports `-` and with that it will use `os.Stdin` insteadof readin the file. Because we have no file extension to auto-detect the format only JSON is supported in this mode. This feature will be used by osbuild-composer when it adds bootc image mode integration.
- Loading branch information
1 parent
19acee6
commit 2217bc5
Showing
4 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
package buildconfig | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func MockConfigRootDir(newDir string) (restore func()) { | ||
saved := configRootDir | ||
configRootDir = newDir | ||
return func() { | ||
configRootDir = saved | ||
} | ||
} | ||
|
||
func MockOsStdin(new *os.File) (restore func()) { | ||
saved := osStdin | ||
osStdin = new | ||
return func() { | ||
osStdin = saved | ||
} | ||
} |