forked from livecycle/preevy
-
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.
add --system-compose-file option (livecycle#93)
- remove config file for now - add new option to allow specifying the compose file path without overriding the default loading order
- Loading branch information
Roy Razon
authored
May 24, 2023
1 parent
ca11842
commit b31ae74
Showing
17 changed files
with
88 additions
and
90 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,6 +1,6 @@ | ||
export * from './lib/plugins/model' | ||
export { HookName, HookFunc, HooksListeners, Hooks } from './lib/hooks' | ||
export { PluginContext, PluginInitContext } from './lib/plugins/context' | ||
export { composeFlags, envIdFlags, configFlags } from './lib/flags' | ||
export { composeFlags, envIdFlags } from './lib/flags' | ||
export { initHook } from './hooks/init/load-plugins' | ||
export { default as BaseCommand } from './commands/base-command' |
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
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import fs from 'fs' | ||
|
||
export type ComposeFiles = { | ||
userSpecifiedFiles: string[] | ||
systemFiles: string[] | ||
} | ||
|
||
const DEFAULT_BASE_FILES = ['compose', 'docker-compose'] | ||
const DEFAULT_OVERRIDE_FILES = DEFAULT_BASE_FILES.map(f => `${f}.override`) | ||
const YAML_EXTENSIONS = ['yaml', 'yml'] | ||
|
||
const oneYamlFile = (baseNames: string[], type: string) => { | ||
const existingFiles = baseNames | ||
.flatMap(f => YAML_EXTENSIONS.map(e => `${f}.${e}`)) | ||
.filter(f => fs.existsSync(f)) | ||
|
||
if (!existingFiles.length) { | ||
return undefined | ||
} | ||
|
||
if (existingFiles.length > 1) { | ||
throw new Error(`Multiple ${type} files found: ${existingFiles.join(', ')}`) | ||
} | ||
|
||
return existingFiles[0] | ||
} | ||
|
||
const findDefaultFiles = () => { | ||
const defaultFile = oneYamlFile(DEFAULT_BASE_FILES, 'default Compose') | ||
if (!defaultFile) { | ||
return [] | ||
} | ||
const overrideFile = oneYamlFile(DEFAULT_OVERRIDE_FILES, 'default Compose override') | ||
return overrideFile ? [defaultFile, overrideFile] : [defaultFile] | ||
} | ||
|
||
export const resolveComposeFiles = ( | ||
{ userSpecifiedFiles, systemFiles }: ComposeFiles, | ||
): string[] => [...userSpecifiedFiles.length ? userSpecifiedFiles : findDefaultFiles(), ...systemFiles] |
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,2 +1,3 @@ | ||
export * from './client' | ||
export * from './model' | ||
export { ComposeFiles, resolveComposeFiles } from './files' |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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