Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
Signed-off-by: Ivo Yankov <ivo@devlabs.bg>
  • Loading branch information
Ivo-Yankov committed Dec 19, 2024
1 parent 507a081 commit 7698f16
Show file tree
Hide file tree
Showing 47 changed files with 127 additions and 135 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ An opinionated CLI tool to deploy and manage standalone test networks.

### Hardware Requirements

To run a three-node network, you will need to set up Docker Desktop with at least 8GB of memory and 4 CPUs.
To run a three-node network, you will need to set up Docker Desktop with at least 8GB of memory and 4 CPUs.

![alt text](/docs/content/User/DockerDesktop.png)

Expand Down
7 changes: 0 additions & 7 deletions docs/content/User/Env.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,3 @@ User can configure the following environment variables to customize the behavior
| `RELAY_PODS_READY_MAX_ATTEMPTS` | The maximum number of attempts to check if relay pods are ready. | `100` |
| `RELAY_PODS_READY_DELAY` | The interval between attempts to check if relay pods are ready, in the unit of milliseconds. | `120` |
| `NETWORK_DESTROY_WAIT_TIMEOUT` | The period of time to wait for network to be destroyed, in the unit of milliseconds. | `60000` |







3 changes: 2 additions & 1 deletion docs/content/User/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ You can run `solo account init` anytime after `solo node start`

### Where can I find the default account keys ?

It is the well known default genesis key [Link](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/data/onboard/GenesisPrivKey.txt)
It is the well known default genesis key [Link](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/data/onboard/GenesisPrivKey.txt)

### How do I get the key for an account?

Use the following command to get account balance and private key of the account `0.0.1007`:

```bash
# get account info of 0.0.1007 and also show the private key
solo account get --account-id 0.0.1007 -n solo-e2e --private-key
Expand Down
1 change: 1 addition & 0 deletions docs/content/User/GetStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ For Hedera extended users:
* [Using Environment Variables](Env.md)

FAQ:

* [Frequently Asked Questions](FAQ.md)

For curious mind:
Expand Down
7 changes: 0 additions & 7 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,6 @@ export default [
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/consistent-type-imports': [
// optional: assists in reducing circular dependencies
'error',
{
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/no-explicit-any': 'warn', // TODO remove (771 errors)
'@typescript-eslint/no-this-alias': [
'error',
Expand Down
1 change: 0 additions & 1 deletion src/commands/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {type CommandFlag} from '../types/flag_types.js';
import {type Lease} from '../core/lease/lease.js';
import {Listr} from 'listr2';
import path from 'path';
import {container, injectable} from "tsyringe-neo";

export interface CommandHandlers {
parent: BaseCommand;
Expand Down
2 changes: 1 addition & 1 deletion src/core/account_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import {K8} from './k8.js';
import {type AccountIdWithKeyPairObject, type ExtendedNetServer} from '../types/index.js';
import {type NodeAlias, type PodName} from '../types/aliases.js';
import {IGNORED_NODE_ACCOUNT_ID} from './constants.js';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

const REASON_FAILED_TO_GET_KEYS = 'failed to get keys for accountId';
const REASON_SKIPPED = 'skipped since it does not have a genesis key';
Expand Down
2 changes: 1 addition & 1 deletion src/core/certificate_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {K8} from './k8.js';
import {SoloLogger} from './logging.js';
import type {ListrTaskWrapper} from 'listr2';
import type {NodeAlias} from '../types/aliases.js';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

/**
* Used to handle interactions with certificates data and inject it into the K8s cluster secrets
Expand Down
2 changes: 1 addition & 1 deletion src/core/chart_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {Helm} from './helm.js';
import chalk from 'chalk';
import {SoloError} from './errors.js';
import {SoloLogger} from './logging.js';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

@autoInjectable()
export class ChartManager {
Expand Down
2 changes: 1 addition & 1 deletion src/core/config/local_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {ConfigManager} from '../config_manager.js';
import type {EmailAddress, Namespace} from './remote/types.js';
import {Templates} from '../templates.js';
import {ErrorMessages} from '../error_messages.js';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

@autoInjectable()
export class LocalConfig implements LocalConfigData {
Expand Down
2 changes: 1 addition & 1 deletion src/core/config/remote/remote_config_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {type ContextClusterStructure} from '../../../types/config_types.js';
import {type EmptyContextConfig, type Optional, type SoloListrTask} from '../../../types/index.js';
import type * as k8s from '@kubernetes/client-node';
import {StatusCodes} from 'http-status-codes';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

interface ListrContext {
config: {contextCluster: ContextClusterStructure};
Expand Down
6 changes: 3 additions & 3 deletions src/core/config_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
* distributed under the License is distributed on an ""AS IS"" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the Licen}se.
* limitations under the License.
*
*/
import {SoloError, MissingArgumentError, IllegalArgumentError} from './errors.js';
import {SoloError, MissingArgumentError} from './errors.js';
import {SoloLogger} from './logging.js';
import {Flags, Flags as flags} from '../commands/flags.js';
import * as paths from 'path';
import * as helpers from './helpers.js';
import type * as yargs from 'yargs';
import {type CommandFlag} from '../types/flag_types.js';
import {type ListrTaskWrapper} from 'listr2';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

/**
* ConfigManager cache command flag values so that user doesn't need to enter the same values repeatedly.
Expand Down
69 changes: 43 additions & 26 deletions src/core/container_init.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
import {container} from "tsyringe-neo";
import {SoloLogger} from "./logging.js";
import {PackageDownloader} from "./package_downloader.js";
import {Zippy} from "./zippy.js";
import {DependencyManager, HelmDependencyManager} from "./dependency_managers/index.js";
import * as constants from "./constants.js";
import {Helm} from "./helm.js";
import {ChartManager} from "./chart_manager.js";
import {ConfigManager} from "./config_manager.js";
import {K8} from "./k8.js";
import {AccountManager} from "./account_manager.js";
import {PlatformInstaller} from "./platform_installer.js";
import {KeyManager} from "./key_manager.js";
import {ProfileManager} from "./profile_manager.js";
import type {LeaseRenewalService} from "./lease/lease.js";
import {IntervalLeaseRenewalService} from "./lease/interval_lease_renewal.js";
import {LeaseManager} from "./lease/lease_manager.js";
import {CertificateManager} from "./certificate_manager.js";
import path from "path";
import {LocalConfig} from "./config/local_config.js";
import {RemoteConfigManager} from "./config/remote/remote_config_manager.js";
/**
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the ""License"");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an ""AS IS"" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {container} from 'tsyringe-neo';
import {SoloLogger} from './logging.js';
import {PackageDownloader} from './package_downloader.js';
import {Zippy} from './zippy.js';
import {DependencyManager, HelmDependencyManager} from './dependency_managers/index.js';
import * as constants from './constants.js';
import {Helm} from './helm.js';
import {ChartManager} from './chart_manager.js';
import {ConfigManager} from './config_manager.js';
import {K8} from './k8.js';
import {AccountManager} from './account_manager.js';
import {PlatformInstaller} from './platform_installer.js';
import {KeyManager} from './key_manager.js';
import {ProfileManager} from './profile_manager.js';
import {IntervalLeaseRenewalService} from './lease/interval_lease_renewal.js';
import {LeaseManager} from './lease/lease_manager.js';
import {CertificateManager} from './certificate_manager.js';
import path from 'path';
import {LocalConfig} from './config/local_config.js';
import {RemoteConfigManager} from './config/remote/remote_config_manager.js';

container.register<SoloLogger>(SoloLogger, {useValue: new SoloLogger('debug', false)});
container.register<PackageDownloader>(PackageDownloader, {useValue: new PackageDownloader()});
Expand All @@ -33,11 +48,13 @@ container.register<AccountManager>(AccountManager, {useValue: new AccountManager
container.register<PlatformInstaller>(PlatformInstaller, {useValue: new PlatformInstaller()});
container.register<KeyManager>(KeyManager, {useValue: new KeyManager()});
container.register<ProfileManager>(ProfileManager, {useValue: new ProfileManager()});
container.register<IntervalLeaseRenewalService>(IntervalLeaseRenewalService, {useValue: new IntervalLeaseRenewalService()});
container.register<LeaseManager>(LeaseManager, {useValue: new LeaseManager(container.resolve(IntervalLeaseRenewalService))});
container.register<IntervalLeaseRenewalService>(IntervalLeaseRenewalService, {
useValue: new IntervalLeaseRenewalService(),
});
container.register<LeaseManager>(LeaseManager, {
useValue: new LeaseManager(container.resolve(IntervalLeaseRenewalService)),
});
container.register<CertificateManager>(CertificateManager, {useValue: new CertificateManager()});

const localConfigPath = path.join(constants.SOLO_CACHE_DIR, constants.DEFAULT_LOCAL_CONFIG_FILE);
container.register<LocalConfig>(LocalConfig, {useValue: new LocalConfig(localConfigPath)});

const remoteConfigManager = container.resolve(RemoteConfigManager);
container.register<RemoteConfigManager>(RemoteConfigManager, {useValue: new RemoteConfigManager()});
4 changes: 2 additions & 2 deletions src/core/dependency_managers/dependency_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {SoloError} from '../errors.js';
import {ShellRunner} from '../shell_runner.js';
import {HelmDependencyManager} from './helm_dependency_manager.js';
import {type ListrTask} from 'listr2';
import {autoInjectable} from "tsyringe-neo";
import * as constants from "../constants.js";
import {autoInjectable} from 'tsyringe-neo';
import * as constants from '../constants.js';

@autoInjectable()
export class DependencyManager extends ShellRunner {
Expand Down
5 changes: 2 additions & 3 deletions src/core/dependency_managers/helm_dependency_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import fs from 'fs';
import os from 'os';
import path from 'path';
import * as util from 'util';
import {IllegalArgumentError, MissingArgumentError} from '../errors.js';
import {MissingArgumentError} from '../errors.js';
import * as helpers from '../helpers.js';
import * as constants from '../constants.js';
import {PackageDownloader} from '../package_downloader.js';
Expand All @@ -28,8 +28,7 @@ import * as version from '../../../version.js';
import {ShellRunner} from '../shell_runner.js';
import * as semver from 'semver';
import {OS_WIN32, OS_WINDOWS} from '../constants.js';
import {type SoloLogger} from '../logging.js';
import {autoInjectable, container, singleton} from "tsyringe-neo";
import {container, singleton} from 'tsyringe-neo';

// constants required by HelmDependencyManager
const HELM_RELEASE_BASE_URL = 'https://get.helm.sh';
Expand Down
6 changes: 2 additions & 4 deletions src/core/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ import os from 'os';
import * as constants from './constants.js';
import {ShellRunner} from './shell_runner.js';
import {Templates} from './templates.js';
import {singleton} from "tsyringe-neo";
import {singleton} from 'tsyringe-neo';

@singleton()
export class Helm extends ShellRunner {
private readonly helmPath: string;

constructor(
private readonly osPlatform: NodeJS.Platform = os.platform(),
) {
constructor(private readonly osPlatform: NodeJS.Platform = os.platform()) {
super();
this.helmPath = Templates.installationPath(constants.HELM, this.osPlatform);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/k8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {type PodName, type TarCreateFilter} from '../types/aliases.js';
import type {ExtendedNetServer, LocalContextObject} from '../types/index.js';
import {HEDERA_HAPI_PATH, ROOT_CONTAINER, SOLO_LOGS_DIR} from './constants.js';
import {Duration} from './time/duration.js';
import {autoInjectable, container} from "tsyringe-neo";
import {autoInjectable, container} from 'tsyringe-neo';

interface TDirectoryData {
directory: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/core/key_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import chalk from 'chalk';
import {type NodeAlias, type NodeAliases} from '../types/aliases.js';
import {type NodeKeyObject, type PrivateKeyAndCertificateObject} from '../types/index.js';
import type {ListrTask} from 'listr2';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

// @ts-ignore
x509.cryptoProvider.set(crypto);
Expand Down
2 changes: 1 addition & 1 deletion src/core/lease/interval_lease_renewal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
import {type Lease, type LeaseRenewalService} from './lease.js';
import {Duration} from '../time/duration.js';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

/**
* Implements a lease renewal service which utilizes a setInterval() based approach to renew leases at regular intervals.
Expand Down
4 changes: 2 additions & 2 deletions src/core/lease/lease_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {type Lease, LeaseRenewalService} from './lease.js';
import {IntervalLease} from './interval_lease.js';
import {LeaseHolder} from './lease_holder.js';
import {LeaseAcquisitionError} from './lease_errors.js';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

/**
* Manages the acquisition and renewal of leases.
Expand All @@ -41,7 +41,7 @@ export class LeaseManager {
private readonly _renewalService?: LeaseRenewalService,
private readonly _logger?: SoloLogger,
private readonly k8?: K8,
private readonly configManager?: ConfigManager
private readonly configManager?: ConfigManager,
) {}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as util from 'util';
import chalk from 'chalk';
import path from 'path';
import * as constants from './constants.js';
import {injectable, singleton} from "tsyringe-neo";
import {singleton} from 'tsyringe-neo';

const customFormat = winston.format.combine(
winston.format.label({label: 'SOLO', message: false}),
Expand Down
2 changes: 1 addition & 1 deletion src/core/package_downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {Templates} from './templates.js';
import * as constants from './constants.js';
import {SoloLogger} from './logging.js';
import {StatusCodes} from 'http-status-codes';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

@autoInjectable()
export class PackageDownloader {
Expand Down
8 changes: 6 additions & 2 deletions src/core/platform_installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ import {SoloLogger} from './logging.js';
import type {NodeAlias, NodeAliases, PodName} from '../types/aliases.js';
import {Duration} from './time/duration.js';
import {sleep} from './helpers.js';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

/** PlatformInstaller install platform code in the root-container of a network pod */
@autoInjectable()
export class PlatformInstaller {
constructor(private logger?: SoloLogger, private k8?: K8, private configManager?: ConfigManager) {}
constructor(
private logger?: SoloLogger,
private k8?: K8,
private configManager?: ConfigManager,
) {}

private _getNamespace(): string {
const ns = this.configManager.getFlag<string>(flags.namespace) as string;
Expand Down
2 changes: 1 addition & 1 deletion src/core/profile_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import * as helpers from './helpers.js';
import {getNodeAccountMap} from './helpers.js';
import {SoloLogger} from './logging.js';
import type {NodeAlias, NodeAliases} from '../types/aliases.js';
import {container, singleton} from "tsyringe-neo";
import {container, singleton} from 'tsyringe-neo';

const consensusSidecars = [
'recordStreamUploader',
Expand Down
2 changes: 1 addition & 1 deletion src/core/shell_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {spawn} from 'child_process';
import chalk from 'chalk';
import {SoloLogger} from './logging.js';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

@autoInjectable()
export class ShellRunner {
Expand Down
2 changes: 1 addition & 1 deletion src/core/zippy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as tar from 'tar';
import chalk from 'chalk';
import path from 'path';
import {SoloLogger} from './logging.js';
import {autoInjectable} from "tsyringe-neo";
import {autoInjectable} from 'tsyringe-neo';

@autoInjectable()
export class Zippy {
Expand Down
Loading

0 comments on commit 7698f16

Please sign in to comment.