fixed some env vars for ci
This commit is contained in:
parent
5707e2c4e5
commit
c9c1ae4c16
|
@ -78,12 +78,12 @@ jobs:
|
||||||
- { python: "3.11", os: "ubuntu-latest", session: "docs-build" }
|
- { python: "3.11", os: "ubuntu-latest", session: "docs-build" }
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NOXSESSION: ${{ matrix.session }}
|
|
||||||
SPIFF_DATABASE_TYPE: ${{ matrix.database }}
|
|
||||||
FORCE_COLOR: "1"
|
|
||||||
PRE_COMMIT_COLOR: "always"
|
|
||||||
DB_PASSWORD: password
|
|
||||||
FLASK_SESSION_SECRET_KEY: super_secret_key
|
FLASK_SESSION_SECRET_KEY: super_secret_key
|
||||||
|
FORCE_COLOR: "1"
|
||||||
|
NOXSESSION: ${{ matrix.session }}
|
||||||
|
PRE_COMMIT_COLOR: "always"
|
||||||
|
SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD: password
|
||||||
|
SPIFFWORKFLOW_BACKEND_DATABASE_TYPE: ${{ matrix.database }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repository
|
- name: Check out the repository
|
||||||
|
|
|
@ -40,7 +40,7 @@ if [[ "${1:-}" == "clean" ]]; then
|
||||||
|
|
||||||
# TODO: check to see if the db already exists and we can connect to it. also actually clean it up.
|
# TODO: check to see if the db already exists and we can connect to it. also actually clean it up.
|
||||||
# start postgres in background with one db
|
# start postgres in background with one db
|
||||||
if [[ "${SPIFFWORKFLOW_BACKEND_SPIFF_DATABASE_TYPE:-}" == "postgres" ]]; then
|
if [[ "${SPIFFWORKFLOW_BACKEND_DATABASE_TYPE:-}" == "postgres" ]]; then
|
||||||
if ! docker exec -it postgres-spiff psql -U spiffworkflow_backend spiffworkflow_backend_testing -c "select 1"; then
|
if ! docker exec -it postgres-spiff psql -U spiffworkflow_backend spiffworkflow_backend_testing -c "select 1"; then
|
||||||
docker run --name postgres-spiff -p 5432:5432 -e POSTGRES_PASSWORD=spiffworkflow_backend -e POSTGRES_USER=spiffworkflow_backend -e POSTGRES_DB=spiffworkflow_backend_testing -d postgres
|
docker run --name postgres-spiff -p 5432:5432 -e POSTGRES_PASSWORD=spiffworkflow_backend -e POSTGRES_USER=spiffworkflow_backend -e POSTGRES_DB=spiffworkflow_backend_testing -d postgres
|
||||||
sleep 4 # classy
|
sleep 4 # classy
|
||||||
|
|
|
@ -17,17 +17,17 @@ def setup_database_uri(app: Flask) -> None:
|
||||||
"""Setup_database_uri."""
|
"""Setup_database_uri."""
|
||||||
if app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_URI") is None:
|
if app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_URI") is None:
|
||||||
database_name = f"spiffworkflow_backend_{app.config['ENV_IDENTIFIER']}"
|
database_name = f"spiffworkflow_backend_{app.config['ENV_IDENTIFIER']}"
|
||||||
if app.config.get("SPIFFWORKFLOW_BACKEND_SPIFF_DATABASE_TYPE") == "sqlite":
|
if app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_TYPE") == "sqlite":
|
||||||
app.config["SQLALCHEMY_DATABASE_URI"] = (
|
app.config["SQLALCHEMY_DATABASE_URI"] = (
|
||||||
f"sqlite:///{app.instance_path}/db_{app.config['ENV_IDENTIFIER']}.sqlite3"
|
f"sqlite:///{app.instance_path}/db_{app.config['ENV_IDENTIFIER']}.sqlite3"
|
||||||
)
|
)
|
||||||
elif app.config.get("SPIFFWORKFLOW_BACKEND_SPIFF_DATABASE_TYPE") == "postgres":
|
elif app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_TYPE") == "postgres":
|
||||||
app.config["SQLALCHEMY_DATABASE_URI"] = (
|
app.config["SQLALCHEMY_DATABASE_URI"] = (
|
||||||
f"postgresql://spiffworkflow_backend:spiffworkflow_backend@localhost:5432/{database_name}"
|
f"postgresql://spiffworkflow_backend:spiffworkflow_backend@localhost:5432/{database_name}"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# use pswd to trick flake8 with hardcoded passwords
|
# use pswd to trick flake8 with hardcoded passwords
|
||||||
db_pswd = os.environ.get("DB_PASSWORD")
|
db_pswd = app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD")
|
||||||
if db_pswd is None:
|
if db_pswd is None:
|
||||||
db_pswd = ""
|
db_pswd = ""
|
||||||
app.config["SQLALCHEMY_DATABASE_URI"] = (
|
app.config["SQLALCHEMY_DATABASE_URI"] = (
|
||||||
|
|
|
@ -91,8 +91,8 @@ SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = environ.get(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Database Configuration
|
# Database Configuration
|
||||||
SPIFFWORKFLOW_BACKEND_SPIFF_DATABASE_TYPE = environ.get(
|
SPIFFWORKFLOW_BACKEND_DATABASE_TYPE = environ.get(
|
||||||
"SPIFFWORKFLOW_BACKEND_SPIFF_DATABASE_TYPE", default="mysql"
|
"SPIFFWORKFLOW_BACKEND_DATABASE_TYPE", default="mysql"
|
||||||
) # can also be sqlite, postgres
|
) # can also be sqlite, postgres
|
||||||
# Overide above with specific sqlalchymy connection string.
|
# Overide above with specific sqlalchymy connection string.
|
||||||
SPIFFWORKFLOW_BACKEND_DATABASE_URI = environ.get(
|
SPIFFWORKFLOW_BACKEND_DATABASE_URI = environ.get(
|
||||||
|
@ -112,3 +112,13 @@ SPIFFWORKFLOW_BACKEND_ALLOW_CONFISCATING_LOCK_AFTER_SECONDS = int(
|
||||||
SPIFFWORKFLOW_BACKEND_DEFAULT_USER_GROUP = environ.get(
|
SPIFFWORKFLOW_BACKEND_DEFAULT_USER_GROUP = environ.get(
|
||||||
"SPIFFWORKFLOW_BACKEND_DEFAULT_USER_GROUP", default="everybody"
|
"SPIFFWORKFLOW_BACKEND_DEFAULT_USER_GROUP", default="everybody"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# secrets: These should be set as environment variables
|
||||||
|
SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD = environ.get("SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD", default="")
|
||||||
|
SPIFFWORKFLOW_BACKEND_GITHUB_WEBHOOK_SECRET = environ.get("SPIFFWORKFLOW_BACKEND_GITHUB_WEBHOOK_SECRET", default='')
|
||||||
|
SPIFFWORKFLOW_BACKEND_GIT_SSH_PRIVATE_KEY = environ.get("SPIFFWORKFLOW_BACKEND_GIT_SSH_PRIVATE_KEY", default='')
|
||||||
|
SPIFFWORKFLOW_BACKEND_GIT_USER_PASSWORD = environ.get("SPIFFWORKFLOW_BACKEND_GIT_USER_PASSWORD", default='')
|
||||||
|
SPIFFWORKFLOW_BACKEND_SENTRY_DSN = environ.get("SPIFFWORKFLOW_BACKEND_SENTRY_DSN", default='')
|
||||||
|
SPIFFWORKFLOW_BACKEND_SENTRY_ORGANIZATION_SLUG = environ.get("SPIFFWORKFLOW_BACKEND_SENTRY_ORGANIZATION_SLUG", default='')
|
||||||
|
SPIFFWORKFLOW_BACKEND_SENTRY_PROJECT_SLUG = environ.get("SPIFFWORKFLOW_BACKEND_SENTRY_PROJECT_SLUG", default='')
|
||||||
|
SPIFFWORKFLOW_BACKEND_SENTRY_SAMPLE_RATE = environ.get("SPIFFWORKFLOW_BACKEND_SENTRY_SAMPLE_RATE", default='')
|
||||||
|
|
|
@ -674,7 +674,7 @@ def _get_potential_owner_usernames(assigned_user: AliasedClass) -> Any:
|
||||||
potential_owner_usernames_from_group_concat_or_similar = func.group_concat(
|
potential_owner_usernames_from_group_concat_or_similar = func.group_concat(
|
||||||
assigned_user.username.distinct()
|
assigned_user.username.distinct()
|
||||||
).label("potential_owner_usernames")
|
).label("potential_owner_usernames")
|
||||||
db_type = current_app.config.get("SPIFFWORKFLOW_BACKEND_SPIFF_DATABASE_TYPE")
|
db_type = current_app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_TYPE")
|
||||||
|
|
||||||
if db_type == "postgres":
|
if db_type == "postgres":
|
||||||
potential_owner_usernames_from_group_concat_or_similar = func.string_agg(
|
potential_owner_usernames_from_group_concat_or_similar = func.string_agg(
|
||||||
|
|
Loading…
Reference in New Issue