Tidying; add .env.sample

This commit is contained in:
3wc 2021-08-16 02:27:59 +02:00
parent b3c655bc47
commit 0574d58a7c
6 changed files with 15 additions and 11 deletions

11
.env.sample Normal file
View File

@ -0,0 +1,11 @@
# Optional, default `mock`
#SPOKE_MODEL=shell-scripts
# Optional, default `0`
#FLASK_DEBUG=0
# Optional, default `http://localhost:5000`
#BASE_URL=http://localhost:5000
# Optional, default `qemu:///system` if you're root, otherwise `qemu:///session`
#VIRSH_DEFAULT_CONNECT_URI=qemu:///system
#ADMIN_PANEL_ALLOW_EMAIL_ADDRESSES=3wc.capsul@doesthisthing.work
# Optional, default no theme
#THEME=yolocolo

View File

@ -59,6 +59,7 @@ def create_app(http_client_factory):
LOG_LEVEL=config.get("LOG_LEVEL", "INFO"),
SPOKE_HOST_ID=config.get("SPOKE_HOST_ID", "baikal"),
SPOKE_HOST_TOKEN=config.get("SPOKE_HOST_TOKEN", "changeme"),
SSH_USERNAME=os.environ.get("SSH_USERNAME", default="cyberian"),
HUB_TOKEN=config.get("HUB_TOKEN", "changeme"),
# https://www.postgresql.org/docs/9.1/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS

View File

@ -12,8 +12,6 @@ class LoginTests(BaseTestCase):
response = client.get(url_for("auth.login"))
self.assert_200(response)
# FIXME test generated login link
def test_login_magiclink(self):
token, ignoreCaseMatches = get_model().login('test@example.com')

View File

@ -29,7 +29,6 @@ class ConsoleTests(BaseTestCase):
def setUp(self):
super().setUp()
get_model().cursor.execute("DELETE FROM host_operation")
get_model().cursor.execute("DELETE FROM operations")
get_model().cursor.execute("DELETE FROM vm_ssh_host_key")
@ -48,8 +47,6 @@ class ConsoleTests(BaseTestCase):
for host_id in host_ids:
get_model().host_heartbeat(host_id)
def test_index(self):
self._login('test@example.com')
with self.client as client:
@ -80,7 +77,6 @@ class ConsoleTests(BaseTestCase):
0
)
def test_create_fails_capacity(self):
with self.client as client:
@ -162,7 +158,6 @@ class ConsoleTests(BaseTestCase):
url_for("console.index") + f'?created={vm_id}'
)
def test_keys_loads(self):
self._login('test@example.com')
with self.client as client:
@ -215,5 +210,3 @@ class ConsoleTests(BaseTestCase):
'A key with that name already exists',
category='message'
)

View File

@ -26,7 +26,7 @@ from capsulflask.shared import *
class BaseTestCase(TestCase):
def create_app(self):
# Use default connection paramaters
os.environ['POSTGRES_CONNECTION_PARAMETERS'] = "host=localhost port=5432 user=postgres password=dev dbname=capsulflask_test"
os.environ['POSTGRES_CONNECTION_PARAMETERS'] = "host=db port=5432 user=capsul password=capsul dbname=capsulflask_test"
os.environ['TESTING'] = 'True'
os.environ['LOG_LEVEL'] = 'DEBUG'
os.environ['SPOKE_MODEL'] = 'mock'

View File

@ -3,6 +3,7 @@
Create a `.env` file to set up the application configuration:
```
cp .env.sample .env
nano .env
```