Skip to content

Commit

Permalink
Cleanup on dev/prod environment
Browse files Browse the repository at this point in the history
  • Loading branch information
abbudao committed Oct 27, 2019
1 parent 6fdc64f commit 56d04c1
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 75 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/cd-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- "master"
- "submission"
jobs:
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -33,10 +34,11 @@ jobs:
DYNACONF_DB_API: ${{ secrets.db_api }}
DYNACONF_DB_NAME: ${{ secrets.db_name }}
DYNACONF_DB_CONN_NAME: ${{ secrets.db_conn_name }}
DYNACONF_GITHUB_CLIENT_SECRET: ${{ client_secret }}
DYNACONF_GITHUB_CLIENT_ID: ${{ client_id }
DYNACONF_GITHUB_URI_USER: "https://github.com/login/oauth/access_token"
DYNACONF_GITHUB_URI_OAUTH: "https://api.github.com/user"
DYNACONF_GITHUB_CLIENT_SECRET: ${{ secrets.client_secret }}
DYNACONF_GITHUB_CLIENT_ID: ${{ secrets.client_id }}
DYNACONF_GITHUB_URI_OAUTH: https://github.com/login/oauth/access_token
DYNACONF_GITHUB_URI_USER: https://api.github.com/user
DYNACONF_FLASK_SECRET: ${{ secrets.flask_secret }}
run: env | grep DYNACONF_ > .env
- name: Deploy to GCP AppEngine
uses: actions/gcloud/cli@master
Expand Down
4 changes: 2 additions & 2 deletions connectors/exercism/populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def get_or_create_default_user(db_session):
name="exercism.io",
nickname="exercism",
is_teacher=True,
github_token="",
token="")
github_token="sample-github-token",
token="sample-github-token")
db_session.add(exercism_user)
db_session.flush()
return exercism_user
Expand Down
50 changes: 24 additions & 26 deletions db/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,34 @@
from models import Base


def create_schema(api, username, password, name, conn_name=None, echo=False):
unix_socket = f'/cloudsql/{conn_name}'
engine = create_engine(
url.URL(
drivername=api,
username=username,
password=password,
database=name,
query={
'host': unix_socket
}),
client_encoding="utf8",
echo=echo)
def create_db_uri(api, username, password, name, conn_name,
production):
if production:
unix_socket = f'/cloudsql/{conn_name}'
db_uri = url.URL(drivername=api, username=username, password=password,
database=name, query={'host': unix_socket})

else:
db_uri = url.URL(drivername=api, username=username, host="localhost",
password=password, database=name)

return db_uri


def create_schema(api, username, password, name,
conn_name=None, echo=False, production=False):
db_uri = create_db_uri(api, username, password,
name, conn_name, production)

engine = create_engine(db_uri, client_encoding="utf8", echo=echo)
return Base.metadata.create_all(engine)


def database_setup(api, username, password, name, conn_name=None, echo=False):
unix_socket = f'/cloudsql/{conn_name}'
engine = create_engine(
url.URL(
drivername=api,
username=username,
password=password,
database=name,
query={
'host': unix_socket
}),
client_encoding="utf8",
echo=echo)
def database_setup(api, username, password, name, conn_name=None,
echo=False, production=False):

db_uri = create_db_uri(api, username, password,
name, conn_name, production)
engine = create_engine(db_uri, client_encoding="utf8", echo=echo)
sess = orm.sessionmaker(bind=engine)
return sess()
2 changes: 0 additions & 2 deletions server/static/js/main.71351dde.chunk.js

This file was deleted.

1 change: 0 additions & 1 deletion server/static/js/main.71351dde.chunk.js.map

This file was deleted.

Loading

0 comments on commit 56d04c1

Please sign in to comment.