mix confispex.gen.doc.md (confispex v1.1.0)
Generate a doc in markdown format
Examples
$ mix confispex.gen.doc.md --output=RUNTIME_ENV_PROD.md --schema=MyRuntimeConfigSchema --env=prod --target=abc
Example of generated markdown
# Variables (env=dev target=host)
## GROUP :dev_space
| Name | Required | Default | Description |
| ------------------ | -------- | ------- | ------------------------- |
| DEV_SPACE_PASSWORD | required | | A password for /dev space |
| DEV_SPACE_USERNAME | required | | A username for /dev space |
## GROUP :primary_db
| Name | Required | Default | Description |
| ------------------ | -------- | --------- | ---------------------- |
| DATABASE_HOST | | localhost | DB host (postgres) |
| DATABASE_NAME | | myapp_dev | DB name (postgres) |
| DATABASE_PASSWORD | | postgres | DB password (postgres) |
| DATABASE_POOL_SIZE | | 10 | |
| DATABASE_PORT | | 5432 | DB port (postgres) |
| DATABASE_USERNAME | | postgres | DB username (postgres) |
Integration with ex_doc
Adjust your mix.exs
file with the following content
defmodule MyApp.MixProject do
use Mix.Project
def project do
[
# ...
aliases: aliases(),
docs: [
extras: [
"tmp/runtime_env_prod.md": [title: "prod"],
"tmp/runtime_env_dev.md": [title: "dev"],
"tmp/runtime_env_test.md": [title: "test"]
],
groups_for_extras: [
"Runtime ENV": ~r|tmp/runtime_env_.+\.md|
]
]
]
end
defp aliases do
[
# ...
docs: [
fn _ -> File.mkdir_p!("tmp") end
| Enum.map(["test", "prod", "dev"], fn env ->
fn _ ->
Mix.Task.rerun("confispex.gen.doc.md", [
"--output",
"tmp/runtime_env_#{env}.md",
"--schema",
"MyApp.RuntimeConfigSchema", # <--- Change module name
"--env",
env
])
end
end) ++ ["docs"]
]
]
end
end
Link to this section Summary
Functions
Callback implementation for Mix.Task.run/1
.
Link to this section Functions
Link to this function
run(args)
Callback implementation for Mix.Task.run/1
.