Small config file
Added a small config file with some variables
This commit is contained in:
parent
82625c9d73
commit
edc3e55ead
22
.gitea/workflows/buildah-ci.yml
Normal file
22
.gitea/workflows/buildah-ci.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
name: Build and Push Image with Buildah
|
||||||
|
on: [ push ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build and push image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build Image
|
||||||
|
id: build-image
|
||||||
|
uses: redhat-actions/buildah-build@v2
|
||||||
|
with:
|
||||||
|
image: my-app
|
||||||
|
tags: latest ${{ github.sha }}
|
||||||
|
containerfiles: |
|
||||||
|
./Containerfile
|
||||||
|
|
||||||
|
- name: Print image url
|
||||||
|
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -6,7 +6,9 @@
|
||||||
!/.gitignore
|
!/.gitignore
|
||||||
!/README.md
|
!/README.md
|
||||||
!/requirements.txt
|
!/requirements.txt
|
||||||
|
!/.gitea**
|
||||||
|
|
||||||
/flask/static/covers/**
|
/flask/static/covers/**
|
||||||
!/flask/static/covers/default.webp
|
!/flask/static/covers/default.webp
|
||||||
|
/flask/config.py
|
||||||
**__pycache__**
|
**__pycache__**
|
|
@ -13,9 +13,14 @@ Install the dependencies:
|
||||||
```bash
|
```bash
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
Start the server:
|
Edit the configuration:
|
||||||
```bash
|
```bash
|
||||||
cd flask
|
cd flask
|
||||||
|
cp example.config.py config.py
|
||||||
|
$EDITOR config.py
|
||||||
|
```
|
||||||
|
Start the server:
|
||||||
|
```bash
|
||||||
python app.py
|
python app.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ from hashlib import sha256
|
||||||
from uuid import uuid4 as uuid
|
from uuid import uuid4 as uuid
|
||||||
## Import db class from func.py and initialise it
|
## Import db class from func.py and initialise it
|
||||||
from func import db
|
from func import db
|
||||||
|
## import all config variables
|
||||||
|
from config import *
|
||||||
db=db()
|
db=db()
|
||||||
db.startup()
|
db.startup()
|
||||||
|
|
||||||
|
@ -82,7 +84,7 @@ def loginpage():
|
||||||
return passhash
|
return passhash
|
||||||
# if passwords match, create session and return cookie
|
# if passwords match, create session and return cookie
|
||||||
if password.upper() == passhash.upper():
|
if password.upper() == passhash.upper():
|
||||||
lifetime=3000000 # lifetime of the sesskey in seconds
|
lifetime=RAR_COOKIE_LIFETIME # lifetime of the sesskey in seconds
|
||||||
sesskey=str(uuid())
|
sesskey=str(uuid())
|
||||||
db.set_sesskey(sesskey,userid,lifetime)
|
db.set_sesskey(sesskey,userid,lifetime)
|
||||||
resp=setcookie("session",sesskey,lifetime)
|
resp=setcookie("session",sesskey,lifetime)
|
||||||
|
|
6
flask/example.config.py
Normal file
6
flask/example.config.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
MARIADB_USER="rar_index_app"
|
||||||
|
MARIADB_PASSWORD="password"
|
||||||
|
MARIADB_HOST="db"
|
||||||
|
MARIADB_DB="rar_index"
|
||||||
|
|
||||||
|
RAR_COOKIE_LIFETIME=3000000 # cookie lifetime in seconds
|
|
@ -5,10 +5,10 @@ import time,re
|
||||||
|
|
||||||
## params populated with environment variables, defaults can be changed for a permanent solution
|
## params populated with environment variables, defaults can be changed for a permanent solution
|
||||||
conn_params={
|
conn_params={
|
||||||
"user" : environ.get('MARIADB_USER') if environ.get('MARIADB_USER') else "rar_index_app",
|
"user" : environ.get('MARIADB_USER') if environ.get('MARIADB_USER') else MARIADB_USER,
|
||||||
"password" : environ.get('MARIADB_PASSWORD') if environ.get('MARIADB_PASSWORD') else "password",
|
"password" : environ.get('MARIADB_PASSWORD') if environ.get('MARIADB_PASSWORD') else MARIADB_PASSWORD,
|
||||||
"host" : environ.get('MARIADB_HOST') if environ.get('MARIADB_HOST') else "marcelsite.com",
|
"host" : environ.get('MARIADB_HOST') if environ.get('MARIADB_HOST') else MARIADB_HOST,
|
||||||
"database" : environ.get('MARIADB_DB') if environ.get('MARIADB_DB') else "rar_index"
|
"database" : environ.get('MARIADB_DB') if environ.get('MARIADB_DB') else MARIAD_DB
|
||||||
}
|
}
|
||||||
|
|
||||||
class db:
|
class db:
|
||||||
|
|
Loading…
Reference in a new issue