Add contact info to service
All checks were successful
Build and Publish / build_and_publish (push) Successful in 31s

This commit is contained in:
Nexus 2024-07-11 17:57:01 +01:00
parent 7af49cbb84
commit c7155cbd65
Signed by: nex
GPG key ID: 0FA334385D0B689F
3 changed files with 16 additions and 2 deletions

View file

@ -5,6 +5,9 @@ services:
- "8000:80"
environment:
- DATABASE_URL=postgres://elongate:elongate@db:5432/elongate
#- CONTACT_NAME=Your Name Here
#- CONTACT_EMAIL=your@email.example
#- CONTACT_URL=https://your.website.example/contact
depends_on:
- db
db:

View file

@ -27,6 +27,15 @@ except FileNotFoundError:
WORDS = []
def get_contact_details():
v = {"name": os.getenv("CONTACT_NAME", "not specified")}
if (email := os.getenv("CONTACT_EMAIL")) is not None:
v["email"] = email
if (url := os.getenv("CONTACT_URL")) is not None:
v["url"] = url
return v
@asynccontextmanager
async def lifespan(_app: FastAPI):
if os.path.exists("./data"):
@ -43,7 +52,7 @@ async def lifespan(_app: FastAPI):
yield
app = FastAPI(lifespan=lifespan)
app = FastAPI(lifespan=lifespan, contact=get_contact_details())
templates = Jinja2Templates(directory="templates")

View file

@ -80,7 +80,9 @@
<h1>Create redirect</h1>
<p>Link shorteners? nah. Link Elongater. Make your URLs really long.</p>
<p>
WARNING: This service is operated out of good faith, please return that good faith. If you find any redirects that are harmful or malicious, please report them to the operator of this service.
WARNING: This service is operated out of good faith, please return that good faith.
If you find any redirects that are harmful or malicious, please report them to the operator of this service
(can be found in the <a href="/docs">API Documentation</a>).
</p>
<br/>
<form>