{"id":21595192,"url":"https://github.com/euank/eunodeconfig","last_synced_at":"2025-03-18T11:09:29.278Z","repository":{"id":57231018,"uuid":"45441627","full_name":"euank/EuNodeConfig","owner":"euank","description":"A simple config loader for nodejs. WIP","archived":false,"fork":false,"pushed_at":"2015-11-05T05:12:03.000Z","size":132,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T17:19:16.971Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/euank.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-03T04:27:23.000Z","updated_at":"2015-11-03T04:28:53.000Z","dependencies_parsed_at":"2022-08-29T09:20:40.270Z","dependency_job_id":null,"html_url":"https://github.com/euank/EuNodeConfig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2FEuNodeConfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2FEuNodeConfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2FEuNodeConfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2FEuNodeConfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/euank","download_url":"https://codeload.github.com/euank/EuNodeConfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244207736,"owners_count":20416107,"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":[],"created_at":"2024-11-24T17:33:47.492Z","updated_at":"2025-03-18T11:09:29.263Z","avatar_url":"https://github.com/euank.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EuNodeConfig\n\n**NOTE, THIS IS A WORK IN PROGRESS AND NOT COMPLETE AT THIS TIME**\nTo see what works, look at the test(s).\n\nNode config is a simple library for loading configuration from the environment\nand various file formats. It allows your users to specify their configs in\nvarious formats and takes care of parsing the formats appropriately for you.\n\n## Usage\n\nThis module exports only one function: `loadConfig`.\n\n```javascript\nvar configLoader = require('eu-node-config');\nconfigLoader.loadConfig({\n  username: {\n    default: \"bob\", // A config with a default value can't be required\n  },\n  username2: \"anotherDefaultFormat\",\n  secure: {\n    required: true,\n    error: \"Missing required config value: secure\" // This default message will be printed if you do not supply your own. This can only be used if the config has a validation, such as required.\n  },\n  anotherConfigKey: {\n    error: true\n  },\n  finalConfigKey: {} // This config value will not be required and might not be in the object returned\n}, {\n  configFolders: ['/etc/myconf'],                       // Optional, defaults to working directory and then process base directory\n  filePrefix: 'part-before-the-dot',                    // Optional, defaults to config\n  order: [\"string\", \"environment\", \"json\", \"yaml\", \"defaults\"], // Optional, defaults to the value shown left; earlier values will override later values\n                                                        // other options include \"js\" to load from a .js file\n  configString: '{\"key\": \"value\"}',                     // The 'string' source above.\n}, function(err, config) {\n  console.log(\"Config loaded: \" + config);\n});\n\n// Alternately, promise style\nconfigLoader.loadConfig({username: {default: \"bob\"}, {jsonData: '{\"username\":\"bill\"}'})\n.then(function(config) {\n  console.log(Config loaded: \" + config);\n})\n.error(function(err) {\n  console.log(\"Failed to load config: \" + err);\n});\n```\n\n## Formats supported\n\n### .yaml, .json, and .js\nFrom the above description, your config will be loaded from a file if it begins\nwith your filePrefix (default config) and ends with \".json\" or \".yaml\". If you\nenable \"loadJsConfigs\" it will also load .js extension files.\n\n### Environment variables\nEnvironment variables matching either your config key or your config key\nconverted to upper-case and with camelcasing normalized to underscore\nseperation will be used.\n\nFor example, the config key \"configKey\" will be accessed as either the\nenvironment variable \"configKey\" or \"CONFIG\\_KEY\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuank%2Feunodeconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feuank%2Feunodeconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuank%2Feunodeconfig/lists"}