forked from 3wordchant/capsul-flask
Tidying; add .env.sample
This commit is contained in:
parent
b3c655bc47
commit
0574d58a7c
11
.env.sample
Normal file
11
.env.sample
Normal 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
|
@ -59,6 +59,7 @@ def create_app(http_client_factory):
|
|||||||
LOG_LEVEL=config.get("LOG_LEVEL", "INFO"),
|
LOG_LEVEL=config.get("LOG_LEVEL", "INFO"),
|
||||||
SPOKE_HOST_ID=config.get("SPOKE_HOST_ID", "baikal"),
|
SPOKE_HOST_ID=config.get("SPOKE_HOST_ID", "baikal"),
|
||||||
SPOKE_HOST_TOKEN=config.get("SPOKE_HOST_TOKEN", "changeme"),
|
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"),
|
HUB_TOKEN=config.get("HUB_TOKEN", "changeme"),
|
||||||
|
|
||||||
# https://www.postgresql.org/docs/9.1/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS
|
# https://www.postgresql.org/docs/9.1/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS
|
||||||
|
@ -12,8 +12,6 @@ class LoginTests(BaseTestCase):
|
|||||||
response = client.get(url_for("auth.login"))
|
response = client.get(url_for("auth.login"))
|
||||||
self.assert_200(response)
|
self.assert_200(response)
|
||||||
|
|
||||||
# FIXME test generated login link
|
|
||||||
|
|
||||||
def test_login_magiclink(self):
|
def test_login_magiclink(self):
|
||||||
token, ignoreCaseMatches = get_model().login('test@example.com')
|
token, ignoreCaseMatches = get_model().login('test@example.com')
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ class ConsoleTests(BaseTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|
||||||
|
|
||||||
get_model().cursor.execute("DELETE FROM host_operation")
|
get_model().cursor.execute("DELETE FROM host_operation")
|
||||||
get_model().cursor.execute("DELETE FROM operations")
|
get_model().cursor.execute("DELETE FROM operations")
|
||||||
get_model().cursor.execute("DELETE FROM vm_ssh_host_key")
|
get_model().cursor.execute("DELETE FROM vm_ssh_host_key")
|
||||||
@ -48,8 +47,6 @@ class ConsoleTests(BaseTestCase):
|
|||||||
for host_id in host_ids:
|
for host_id in host_ids:
|
||||||
get_model().host_heartbeat(host_id)
|
get_model().host_heartbeat(host_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_index(self):
|
def test_index(self):
|
||||||
self._login('test@example.com')
|
self._login('test@example.com')
|
||||||
with self.client as client:
|
with self.client as client:
|
||||||
@ -80,7 +77,6 @@ class ConsoleTests(BaseTestCase):
|
|||||||
0
|
0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_create_fails_capacity(self):
|
def test_create_fails_capacity(self):
|
||||||
with self.client as client:
|
with self.client as client:
|
||||||
|
|
||||||
@ -162,7 +158,6 @@ class ConsoleTests(BaseTestCase):
|
|||||||
url_for("console.index") + f'?created={vm_id}'
|
url_for("console.index") + f'?created={vm_id}'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_keys_loads(self):
|
def test_keys_loads(self):
|
||||||
self._login('test@example.com')
|
self._login('test@example.com')
|
||||||
with self.client as client:
|
with self.client as client:
|
||||||
@ -215,5 +210,3 @@ class ConsoleTests(BaseTestCase):
|
|||||||
'A key with that name already exists',
|
'A key with that name already exists',
|
||||||
category='message'
|
category='message'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ from capsulflask.shared import *
|
|||||||
class BaseTestCase(TestCase):
|
class BaseTestCase(TestCase):
|
||||||
def create_app(self):
|
def create_app(self):
|
||||||
# Use default connection paramaters
|
# 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['TESTING'] = 'True'
|
||||||
os.environ['LOG_LEVEL'] = 'DEBUG'
|
os.environ['LOG_LEVEL'] = 'DEBUG'
|
||||||
os.environ['SPOKE_MODEL'] = 'mock'
|
os.environ['SPOKE_MODEL'] = 'mock'
|
||||||
@ -116,4 +116,4 @@ class TestHTTPClient:
|
|||||||
# in the same order as the tasks that we passed in -- which were in the same order as online_hosts
|
# in the same order as the tasks that we passed in -- which were in the same order as online_hosts
|
||||||
results = await asyncio.gather(*tasks)
|
results = await asyncio.gather(*tasks)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
Create a `.env` file to set up the application configuration:
|
Create a `.env` file to set up the application configuration:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
cp .env.sample .env
|
||||||
nano .env
|
nano .env
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user