Skip to content

Commit

Permalink
cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
3goats committed Mar 16, 2024
1 parent 550a696 commit 5e9b49b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 36 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip3 install --user -r requirements.txt && python3 -m bash_kernel.install && printf 'TLSPC_API_KEY={PASTE API KEY}\nVTOKEN={PASTE TOKEN KEY}\n' > .env && touch ./config/config.yaml && touch ./config/private-key.pem"
"postCreateCommand": "pip3 install --user -r requirements.txt && python3 -m bash_kernel.install && touch ./config/config.yaml && touch ./config/private-key.pem"
//&& printf 'TLSPC_API_KEY={PASTE API KEY}\nVTOKEN={PASTE TOKEN KEY}\n' > .env

// Configure tool-specific properties.
// "customizations": {},
Expand Down
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
TLSPC_API_KEY={PASTE API KEY}
TLSPC_API_KEY=f12f357b-aaac-4180-8e5c-c750a8f32ed0
VTOKEN=eyJhbGciOiJFUzI1NiIsImtpZCI6Ikg2aENHR3hlZnRmRDBPZlhfLXA0aWVmOWRLQlFzM1dXTEFVaVlQQWlIWGMiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MTA2OTY5NzQsImlhdCI6MTcxMDYxMDU3NCwiaXNzIjoiaHR0cDovLzE3Mi4yMC4wLjI6ODAwMCIsInN1YiI6Imp3dC10aGlzIiwidmVuYWZpLWZpcmVmbHkuYWxsb3dBbGxQb2xpY2llcyI6ZmFsc2UsInZlbmFmaS1maXJlZmx5LmFsbG93ZWRQb2xpY2llcyI6WyJCYXNpYyBEZW1vIl0sInZlbmFmaS1maXJlZmx5LmNvbmZpZ3VyYXRpb24iOiJCYXNpYyBEZW1vIn0.HboHaNNalxxejKrh-NqXkQl3743QNVFStqpW3zZ-9b3aRpZAjgUZtnVWjJlPQQS4OBMwy0o3Xht9TUfFT7p_AQ
VTOKEN=
53 changes: 19 additions & 34 deletions demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,20 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": 6,
"metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bash: .env: command not found\n"
]
},
{
"ename": "",
"evalue": "127",
"output_type": "error",
"traceback": []
}
],
"outputs": [],
"source": [
"echo \"TLSPC_API_KEY=xxxxxxxxxxxxxx\" "
"echo \"TLSPC_API_KEY={PASTE API KEY HERE}\" > .env"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 1,
"metadata": {
"vscode": {
"languageId": "shellscript"
Expand All @@ -90,13 +76,10 @@
}
],
"source": [
"#-X POST http://192.168.64.6:8000/token \\\n",
"token=$( curl -d \\\n",
" -H \"Content-Type: application/x-www-form-urlencoded\" \\\n",
" -X POST http://localhost:8000/token \\\n",
" -X POST http://localhost:8001/token \\\n",
" -k -s | jq -r '.access_token' )\n",
"# Update the variable in the Docker Compose .env file \n",
"#sed -i '' 's/^\\(VTOKEN=\\).*/\\VTOKEN='\"$token\"'/' .env \n",
"echo VTOKEN=$token >> .env\n",
"echo ${token}\n",
"echo ${token} | jq -R 'split(\".\") | .[0],.[1] | @base64d | fromjson'\n"
Expand Down Expand Up @@ -125,17 +108,6 @@
"echo $csr\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 29,
Expand All @@ -154,7 +126,7 @@
}
],
"source": [
"curl 'https://192.168.64.6:8289/v1/certificatesigningrequest' \\\n",
"curl 'https://localhost:8289/v1/certificatesigningrequest' \\\n",
"--header 'Content-Type: application/json' \\\n",
" -H \"Authorization: Bearer $token\" \\\n",
"--data '{\n",
Expand All @@ -163,6 +135,19 @@
"}' -k -s #| jq -r .certificateChain"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [],
"source": [
"docker exec -it firefly-playground-nginx-1 docker-entrypoint.d/getcert.sh reload"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 5e9b49b

Please sign in to comment.