-
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.
- Loading branch information
Showing
8 changed files
with
182 additions
and
52 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,40 @@ | ||
import execa from 'execa'; | ||
import { ConfiguredOptions, EngineType } from './engine'; | ||
import { debug } from './debug'; | ||
import { isFileExists } from './utils'; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import download from 'download-tarball'; | ||
|
||
export const startZinc = ({ | ||
binaryFilepath, | ||
engine, | ||
port, | ||
zincAdmin, | ||
zincPassword, | ||
}: Pick< | ||
ConfiguredOptions, | ||
'binaryFilepath' | 'engine' | 'port' | 'zincAdmin' | 'zincPassword' | ||
>) => { | ||
return execa(`${binaryFilepath}/${engine}`, { | ||
all: true, | ||
env: { | ||
ZINC_SERVER_PORT: `${port}`, | ||
ZINC_FIRST_ADMIN_USER: zincAdmin, | ||
ZINC_FIRST_ADMIN_PASSWORD: zincPassword, | ||
ZINC_SHARD_NUM: '1', | ||
ZINC_DATA_PATH: `${binaryFilepath}/data`, | ||
}, | ||
}); | ||
}; | ||
|
||
export const downloadZinc = async (url: string, binaryFilepath: string) => { | ||
debug(`checking if binary exists: ${binaryFilepath}`); | ||
if (!(await isFileExists(binaryFilepath))) { | ||
debug(`downloading binary, url: ${url}, path: ${binaryFilepath}`); | ||
await download({ url, dir: binaryFilepath }); | ||
debug(`Downloaded ${EngineType.ZINCSEARCH}`); | ||
} else { | ||
debug(`${EngineType.ZINCSEARCH} already downloaded`); | ||
} | ||
}; |
Oops, something went wrong.