Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully automate dev setup with Gitpod #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM gitpod/workspace-full

# Install custom tools, runtimes, etc.
# For example "bastet", a command-line tetris clone:
# RUN brew install bastet
#
# More information: https://www.gitpod.io/docs/config-docker/
6 changes: 6 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
image:
file: .gitpod.Dockerfile

tasks:
- init: 'echo "TODO: Replace with init/build command"'
command: 'echo "TODO: Replace with command to start project"'
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/LeilaGhods/Samples)

# Samples

This is my sample code
Expand Down
27 changes: 27 additions & 0 deletions crud_python/db_connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider

# This is the Zip file you downloaded
SECURE_CONNECT_BUNDLE = '/workspace/workshop-crud-with-python-and-node/crud-python/creds.zip'
# This is the username, recommended value was SUser
USERNAME = "SUser";
# This is the password, recommended value was SPassword1
PASSWORD = "SPassword1";
# This is the keyspace name, recommended value was spacecraft
KEYSPACE = "spacecraft";

class Connection:
def __init__(self):
self.secure_connect_bundle=SECURE_CONNECT_BUNDLE
self.path_to_creds=''
self.cluster = Cluster(
cloud={
'secure_connect_bundle': self.secure_connect_bundle
},
auth_provider=PlainTextAuthProvider(USERNAME, PASSWORD)
)
self.session = self.cluster.connect(KEYSPACE)
def close(self):
self.cluster.shutdown()
self.session.shutdown()