Skip to content

Commit

Permalink
devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
charliecon committed Sep 10, 2024
1 parent ced51d3 commit d2107f8
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu

# Install Genesys Cloud CLI
RUN curl -s https://sdk-cdn.mypurecloud.com/external/go-cli/linux/dl/install.sh | sudo bash

# Install the Archy CLI
RUN cd ~ && \
mkdir archy && \
curl https://sdk-cdn.mypurecloud.com/archy/latest/archy-linux.zip > archy-linux.zip && \
unzip archy-linux.zip -d ~/archy && \
cd ~
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Terraform and Go",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/terraform:1":{},
"ghcr.io/devcontainers/features/go:1":{},
"ghcr.io/devcontainers/features/python": {}
},
"hostRequirements": {
"cpus": 4,
"memory": "16gb",
"storage": "32gb"
},
"forwardPorts": [
8080
]
}
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ clean:

build:
mkdir -p ${DIST_DIR}
go mod tidy
go build -o ${DIST_DIR} ./...

GOOS = $(shell go env GOOS)
Expand Down
39 changes: 39 additions & 0 deletions scripts/generate_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## This script is included in our .devcontainers setup. We basically use this to generate our an environment variables file that can be used to set the Genesys Cloud environment variables.

import os

def get_user_input(prompt):
return input(prompt).strip()

def generate_shell_script(client_id, client_secret, region):
script_content = f"""#!/bin/bash
export GENESYSCLOUD_OAUTHCLIENT_ID="{client_id}"
export GENESYSCLOUD_OAUTHCLIENT_SECRET="{client_secret}"
export GENESYSCLOUD_REGION="{region}"
echo "Environment variables set successfully!"
"""
return script_content

def main():
print("Please enter the following values to generate the environment variables needed to run terraform against your target environment: ")

client_id = get_user_input("GENESYSCLOUD_OAUTHCLIENT_ID: ")
client_secret = get_user_input("GENESYSCLOUD_OAUTHCLIENT_SECRET: ")
region = get_user_input("GENESYSCLOUD_REGION: ")

script_content = generate_shell_script(client_id, client_secret, region)

script_filename = "/tmp/set_genesys_env.sh"
with open(script_filename, "w") as f:
f.write(script_content)

print(f"\nShell script '{script_filename}' has been generated.")
print(f"To use it, run: source {script_filename}")

#Make the script executable
os.chmod(script_filename, 0o755)

if __name__ == "__main__":
main()

0 comments on commit d2107f8

Please sign in to comment.