-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mixmix/custom-config #264
base: mixmix/load-entropy
Are you sure you want to change the base?
mixmix/custom-config #264
Conversation
fe90ac6
to
8236b29
Compare
resolve conflicts, get ready for review |
NOTE: this is passing all tests but will need a really close review + smoke test before merge. |
@rh0delta I want you to try and break this. I think I got everything but dial up the pedantry with this one. I turned of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good from reading the code, will take some time to test out everything locally tho, so will hold off on the approval
.argParser(aliasOrEndpoint => { | ||
/* see if it's a raw endpoint */ | ||
if (aliasOrEndpoint.match(/^wss?:\/\//)) return aliasOrEndpoint | ||
|
||
/* look up endpoint-alias */ | ||
const storedConfig = getConfigOrNull() | ||
const endpoint = storedConfig?.endpoints?.[aliasOrEndpoint] | ||
if (!endpoint) throw Error('unknown endpoint alias: ' + aliasOrEndpoint) | ||
|
||
return endpoint | ||
}) | ||
.default('wss://testnet.entropy.xyz/') | ||
// NOTE: default cannot be "test-net" as argParser only runs if the -e/--endpoint flag | ||
// or ENTROPY_ENDPOINT env set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the need to delete all of this? I'm all for it, just wondering the reason why
src/common/utils-cli.ts
Outdated
// NOTE: (mix) we expect config to be initialised (see hook in cli) | ||
// ...there was some reason we wanted to preserve a `null` state, | ||
// but I can't recall if it's still relevant, and we need to check | ||
// the downstream ramifications of it being `null` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the null state was for fresh installs, where the config is created in the XDG standardized directory if there is no config found initially.
src/common/utils-cli.ts
Outdated
const account = parseAccountOption(storedConfig, opts.account) | ||
// if this account is not the default selectedAccount, make it so | ||
if (storedConfig.selectedAccount !== account.name) { | ||
await config.set( | ||
{ | ||
...storedConfig, | ||
selectedAccount: account.name | ||
}, | ||
opts.config | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we refactor this to be a separate function? might be cleaner
export function absolutePath (somePath: string) { | ||
switch (somePath.charAt(0)) { | ||
case '.': | ||
return join(process.cwd(), somePath) | ||
case '~': | ||
return join(homedir(), somePath.slice(1)) | ||
default: | ||
return somePath | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
* [NayNay] Testing Mix's Custom Config - the general purpose of the custom config works, however there is alot of work to be done regarding error handling - i have only started testing the custom config feature with a file that doesn't exist: ./custom-files/custom-config-<#>.json - this originally caused issues on the tui and did not allow for anything to start until the tui eventually errored out - similar errors were found with the cli as well - ive fixed the tui for the most part - but theres still lots to do to fix the cli in terms of proper error handling * Update src/common/utils-cli.ts * Update src/common/utils-cli.ts * Update src/common/utils-cli.ts * Update src/common/utils.ts --------- Co-authored-by: mix irving <[email protected]>
This part of a PR chain:
mixmix/config-types → mixmix/load-entropy → mixmix/custom-config
The purpose of this PR is to be able to set a custom config file path for CLI
NOTES
argParser
cannot beasync
.action
, probablyloadEntropy
--config
as the other leaf actionsentropy tui
orentropy ui