{"id":15172699,"url":"https://github.com/hugojosefson/load-config-files","last_synced_at":"2026-01-26T17:31:47.458Z","repository":{"id":62422663,"uuid":"474383345","full_name":"hugojosefson/load-config-files","owner":"hugojosefson","description":"Loads config files.","archived":false,"fork":false,"pushed_at":"2022-05-16T15:09:38.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-28T22:38:28.433Z","etag":null,"topics":["common","config","deno","file","javascript","json","toml","typescript","yaml","yml"],"latest_commit_sha":null,"homepage":"https://deno.land/x/load_config_files","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hugojosefson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-26T15:12:23.000Z","updated_at":"2022-03-30T08:55:59.000Z","dependencies_parsed_at":"2022-11-01T17:33:27.395Z","dependency_job_id":null,"html_url":"https://github.com/hugojosefson/load-config-files","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fload-config-files","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fload-config-files/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fload-config-files/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fload-config-files/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugojosefson","download_url":"https://codeload.github.com/hugojosefson/load-config-files/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239605124,"owners_count":19666998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["common","config","deno","file","javascript","json","toml","typescript","yaml","yml"],"created_at":"2024-09-27T10:03:26.178Z","updated_at":"2025-11-13T08:30:17.603Z","avatar_url":"https://github.com/hugojosefson.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# load_config_files\n\nLoads config files.\n\nSupports joining with common config files, also further up in the directory\nstructure.\n\nFiletypes supported:\n\n- .toml\n- .json\n- .yml\n- .yaml\n- .js\n- .mjs\n- .ts\n\n## Usage\n\nSet up a directory for example like\n[example-config](https://deno.land/x/load_config_files/example-config), in your\ncurrent working directory:\n\n```\nexample-config/\n├── dev/\n│   ├── common.js\n│   ├── myapp1.toml\n│   └── myapp2.toml\n└── prod/\n    ├── common.json\n    ├── myapp1.json\n    └── myapp2.json\n```\n\n```typescript\n// example.ts\n\nimport {\n  Config,\n  CONFIG_FORMATTERS,\n  ConfigFormatter,\n  loadConfig,\n  LoadConfigOptions,\n} from \"https://deno.land/x/load_config_files/mod.ts\";\n\nconst options: LoadConfigOptions = { verbose: false };\n\nconst [formatterId, configRootPath, ...segments] = Deno.args;\nconst configRootUrl = new URL(configRootPath, \"file:\" + Deno.cwd());\nconst config: Config = await loadConfig(configRootUrl, segments, options);\n\nconst formatter: ConfigFormatter = CONFIG_FORMATTERS[formatterId];\nconst output: string = await formatter(config);\n\nconsole.log(output);\n```\n\nRunning the above program:\n\n```sh\ndeno run \\\n  --allow-read \\\n  --allow-net=deno.land \\\n  https://deno.land/x/load_config_files/example.ts \\\n  shell example-config dev myapp2\n```\n\n...would output:\n\n```sh\nCOLOR='purple'\nCUSTOMER_URLS='{\"CustomerA\":\"https://dev.example.com/customers/CustomerA.json\",\"CustomerB\":\"https://dev.example.com/customers/CustomerB.json\",\"CustomerC\":\"https://dev.example.com/customers/CustomerC.json\",\"CustomerD\":\"https://dev.example.com/customers/CustomerD.json\",\"CustomerE\":\"https://dev.example.com/customers/CustomerE.json\"}'\nAPP_ID='myapp2'\n```\n\n### More examples\n\nFor all possible combinations, including different output formats, see\n[example-config/EXAMPLE_ALL_COMBINATIONS.md](https://deno.land/x/load_config_files/example-config/EXAMPLE_ALL_COMBINATIONS.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugojosefson%2Fload-config-files","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugojosefson%2Fload-config-files","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugojosefson%2Fload-config-files/lists"}