diff --git a/.images/git-config-params.png b/.images/git-config-params.png new file mode 100644 index 0000000..55f24a7 Binary files /dev/null and b/.images/git-config-params.png differ diff --git a/git-config/README.md b/git-config/README.md index ac7e96d..02e725d 100644 --- a/git-config/README.md +++ b/git-config/README.md @@ -15,26 +15,32 @@ Runs a script that checks for stored Git credentials `user.name` and `user.email ### Using workspace owner -The credentials can be populated from the workspace owner's information. +The default credentials can be populated from the workspace owner's information. ```hcl module "git-config" { source = "https://registry.coder.com/modules/git-config" agent_id = coder_agent.example.id - username = data.coder_workspace.me.owner - user_email = data.coder_workspace.me.owner_email + default_username = data.coder_workspace.me.owner + default_user_email = data.coder_workspace.me.owner_email } ``` ### Custom credentials -Credentials can also be set manually. +Credentials can also be set manually by the template admin. ```hcl module "git-config" { source = "https://registry.coder.com/modules/git-config" agent_id = coder_agent.example.id - username = "michael" + default_username = "michael" user_email = "michael@example.com" } ``` + +## Coder parameter usage + +With the defaults set, users still have the opportunity to override the template admin's settings with the coder parameter interface. The workspace owner can manually add their credentials during workspace creation or leave them as "default". + +![Coder Parameter Example](../.images/git-config-params.png) diff --git a/git-config/main.test.ts b/git-config/main.test.ts index deaf250..1c2e703 100644 --- a/git-config/main.test.ts +++ b/git-config/main.test.ts @@ -11,15 +11,19 @@ describe("git-config", async () => { testRequiredVariables(import.meta.dir, { agent_id: "foo", + default_user_email: 's@example.tld', + default_username: 'example username', }); it("fails without git", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "foo", + default_user_email: 's@example.tld', + default_username: 'example username', }); const output = await executeScriptInContainer(state, "alpine"); expect(output.exitCode).toBe(1); - expect(output.stdout).toEqual(["Git is not installed!"]); + expect(output.stdout).toEqual(["\u001B[0;1mChecking git-config!", "Git is not installed!"]); }); // it("runs with git", async () => {