Autogen config docs#47
Conversation
|
Fine by me if it does the job! 👍 From an architecture POV it might make sense in the future to put |
|
Should I merge this in that case, or do we still need to do reviews @axelchalon? |
|
I'd wait for Tomek to have a look |
tomusdrw
left a comment
There was a problem hiding this comment.
Seems pretty cool! I'd clean up the code a bit though and will be glad to merge.
|
|
||
| const output_dir = "./docs/" | ||
| const outpit_file = "config.md" | ||
| const pre_example_config = new BufferList("---\ntitle: Configuring Parity Ethereum\n---\n\nParity can be configured using either the [CLI options](#cli-options) or a [config file](#config-file). Should the CLI flags and the config file disagree about a setting, the CLI takes precedence.\n\nYou can list all CLI options by running `$parity --help`. The vast majority of CLI options map to a setting in the TOML file, for example `--mode-timeout 500` can be set by creating a config file:\n\n```toml\n[parity]\nmode_timeout = 500\n```\n\n## Config File\n\nParity can be configured using a [TOML](https://github.com/toml-lang/toml) file. The file can be generated using the [Parity Config Generator](https://paritytech.github.io/parity-config-generator/). To start parity with a config file, the file needs to be located in:\n\n* Windows: `%UserProfile%\\AppData\\Roaming\\Parity\\Ethereum\\config.toml`\n* Linux: `~/.local/share/io.parity.ethereum/config.toml`\n* macOS: `$HOME/Library/Application Support/io.parity.ethereum/config.toml`\n\nTo use a custom path run `$ parity --config path/to/config.toml`.\n\n\n## Default config.toml\n\nThe following is a representation of a configuration file with all default values (*note: the `[stratum]` section is not present by default, and including it in your config currently enables stratum*).\n```toml\n"); |
There was a problem hiding this comment.
maybe use ` (backtick) and format the newlines properly? (although you would need to escape inline backticks).
I think it would be best to put this to a separate file and just fs.readFileSync from the template file.
There was a problem hiding this comment.
made a separate file with all the template stuff but I'm not sure if it's what you were thinking of 😅
|
I need to test whether the change I made to generate-config-data (grab local mod.rs if it exists) actually works, but I'll ask y'all to look at this again if everything works properly. edit: this doesn't seem to work yet :( |
|
was not an issue on the js side- fixed in commit openethereum/parity-ethereum@169c30a |
| })); | ||
| }); | ||
| } else { | ||
| resolve(fs.readFileSync(path.resolve(__dirname, '../../parity/cli/mod.rs'), 'UTF-8')); |
There was a problem hiding this comment.
Maybe this:
const util = require('util');
...
function fetchSource() {
if (process.env.AUTOGENSCRIPT) {
return util.promisify(fs.readFile)(path.resolve(__dirname, '../../parity/cli/mod.rs'), 'UTF-8'));
}
return https.get(...)
....
}There was a problem hiding this comment.
readFile is already an async function, so it returns a promise 👍
| const BufferList = require('bl'); | ||
|
|
||
| module.exports = { | ||
| preExampleConfig: new BufferList(` |
There was a problem hiding this comment.
I was thinking of storing this templates in a regular .md files (since you would get syntax highlighting) and then load them via preExampleConfig: fs.readFileSync('./template/pre-example.md', 'utf8'). But this is good enough as well :)
|
ack - shouldn't have merged this before making sure it's run from the right working dir, will make another pr for future changes |
Somewhat "working", might not be the ideal format, but can change anything if needed.
part of: openethereum/parity-ethereum#10067