diff --git a/git-config/README.md b/git-config/README.md index 0827ff5..cba56d0 100644 --- a/git-config/README.md +++ b/git-config/README.md @@ -4,9 +4,16 @@ description: Stores Git configuration from Coder credentials icon: ../.icons/git.svg maintainer_github: coder verified: true -tags: [helper] +tags: [helper, git] --- # git-config -Runs a script that checks for stored Git credentials, populating them with coder credentials when missing. \ No newline at end of file +Runs a script that checks for stored Git credentials, populating them with user's Coder credentials when missing. + + +## Examples + +```hcl + +``` diff --git a/git-config/main.tf b/git-config/main.tf index ff4deec..1245d6c 100644 --- a/git-config/main.tf +++ b/git-config/main.tf @@ -14,9 +14,23 @@ variable "agent_id" { description = "The ID of a Coder agent." } +# TODO: Check if agent ID can provide workspace username and email +variable "username" { + type = string + description = "The username of the Coder workspace owner." +} + +variable "user_email" { + type = string + description = "The email of the Coder workspace owner." +} + resource "coder_script" "personalize" { agent_id = var.agent_id - script = templatefile("${path.module}/run.sh", {}) # TODO: maybe remove templatefile + script = templatefile("${path.module}/run.sh", { + CODER_USERNAME = var.username, + CODER_EMAIL = var.user_email + }) display_name = "Git Config" icon = "/emojis/1f58c.png" # TODO: test if the local git icon works run_on_start = true diff --git a/git-config/run.sh b/git-config/run.sh index 6751ed5..07971ae 100644 --- a/git-config/run.sh +++ b/git-config/run.sh @@ -3,8 +3,8 @@ BOLD='\033[0;1m' CODE='\033[36;40;1m' RESET='\033[0m' -# CODER_EMAIL="${CODER_EMAIL}" -# CODER_USERNAME="${CODER_USERNAME}" +CODER_EMAIL="${CODER_EMAIL}" +CODER_USERNAME="${CODER_USERNAME}" echo "Running git-config script!\n\n"