Skip to content

Commit ae1c949

Browse files
chore: rm config.template (#582)
Signed-off-by: Jeffrey Tang <[email protected]>
1 parent b8f65a6 commit ae1c949

File tree

3 files changed

+2
-86
lines changed

3 files changed

+2
-86
lines changed

resources/templates/config.template

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/core/profile_manager.mjs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,16 +447,13 @@ export class ProfileManager {
447447
* @param {string} releaseTag - release tag e.g. v0.42.0
448448
* @param {string} [appName] - the app name (default: HederaNode.jar)
449449
* @param {string} [chainId] - chain ID (298 for local network)
450-
* @param {string} [template] - path to the config.template file
451450
* @returns {string} the config.txt file path
452451
*/
453-
prepareConfigTxt (namespace, nodeAccountMap, destPath, releaseTag, appName = constants.HEDERA_APP_NAME, chainId = constants.HEDERA_CHAIN_ID, template = path.join(constants.RESOURCES_DIR, 'templates', 'config.template')) {
452+
prepareConfigTxt (namespace, nodeAccountMap, destPath, releaseTag, appName = constants.HEDERA_APP_NAME, chainId = constants.HEDERA_CHAIN_ID) {
454453
if (!nodeAccountMap || nodeAccountMap.size === 0) throw new MissingArgumentError('nodeAccountMap the map of node IDs to account IDs is required')
455-
if (!template) throw new MissingArgumentError('config templatePath is required')
456454
if (!releaseTag) throw new MissingArgumentError('release tag is required')
457455

458456
if (!fs.existsSync(destPath)) throw new IllegalArgumentError(`config destPath does not exist: ${destPath}`, destPath)
459-
if (!fs.existsSync(template)) throw new IllegalArgumentError(`config templatePath does not exist: ${template}`, template)
460457

461458
// init variables
462459
const internalPort = constants.HEDERA_NODE_INTERNAL_GOSSIP_PORT
@@ -467,7 +464,7 @@ export class ProfileManager {
467464

468465
try {
469466
/** @type {string[]} */
470-
const configLines = fs.readFileSync(template, 'utf-8').split('\n')
467+
const configLines = []
471468
configLines.push(`swirld, ${chainId}`)
472469
configLines.push(`app, ${appName}`)
473470

test/unit/core/profile_manager.test.mjs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,6 @@ describe('ProfileManager', () => {
200200
expect(() => profileManager.prepareConfigTxt('', nodeAccountMap, '', version.HEDERA_PLATFORM_VERSION)).toThrow('nodeAccountMap the map of node IDs to account IDs is required')
201201
})
202202

203-
it('should fail when an invalid template path is provided', () => {
204-
const nodeAccountMap = /** @type {Map<string, string>} */ new Map()
205-
nodeAccountMap.set('node1', '0.0.3')
206-
expect(() => profileManager.prepareConfigTxt('', nodeAccountMap, '', version.HEDERA_PLATFORM_VERSION, constants.HEDERA_APP_NAME, constants.HEDERA_CHAIN_ID, '')).toThrow('config templatePath is required')
207-
})
208-
209203
it('should fail when no releaseTag is provided', () => {
210204
const nodeAccountMap = /** @type {Map<string, string>} */ new Map()
211205
nodeAccountMap.set('node1', '0.0.3')
@@ -224,18 +218,5 @@ describe('ProfileManager', () => {
224218
expect(e.message).toContain(destPath)
225219
}
226220
})
227-
228-
it('should fail when template path does not exist', () => {
229-
expect.assertions(2)
230-
const nodeAccountMap = /** @type {Map<string, string>} */ new Map()
231-
nodeAccountMap.set('node1', '0.0.3')
232-
const destPath = path.join(tmpDir, 'staging')
233-
try {
234-
profileManager.prepareConfigTxt('', nodeAccountMap, destPath, version.HEDERA_PLATFORM_VERSION, constants.HEDERA_APP_NAME, constants.HEDERA_CHAIN_ID, 'INVALID')
235-
} catch (e) {
236-
expect(e.message).toContain('config templatePath does not exist')
237-
expect(e.message).toContain('INVALID')
238-
}
239-
})
240221
})
241222
})

0 commit comments

Comments
 (0)