Feature: Made the title configurable
This commit is contained in:
parent
b1ca758e9d
commit
56da6b0a82
1
.env
1
.env
@ -1,3 +1,4 @@
|
|||||||
|
TITLE="Brewman"
|
||||||
HOST=0.0.0.0
|
HOST=0.0.0.0
|
||||||
PORT=80
|
PORT=80
|
||||||
LOG_LEVEL=WARN
|
LOG_LEVEL=WARN
|
||||||
|
@ -7,6 +7,7 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
|||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
# openssl rand -hex 32
|
# openssl rand -hex 32
|
||||||
|
TITLE: str = ""
|
||||||
SECRET_KEY: str = secrets.token_urlsafe(32)
|
SECRET_KEY: str = secrets.token_urlsafe(32)
|
||||||
MIDDLEWARE_SECRET_KEY: str = secrets.token_urlsafe(5)
|
MIDDLEWARE_SECRET_KEY: str = secrets.token_urlsafe(5)
|
||||||
ALGORITHM: str = "HS256"
|
ALGORITHM: str = "HS256"
|
||||||
|
@ -40,6 +40,7 @@ from .routers import (
|
|||||||
recipe,
|
recipe,
|
||||||
recipe_template,
|
recipe_template,
|
||||||
role,
|
role,
|
||||||
|
title,
|
||||||
user,
|
user,
|
||||||
voucher,
|
voucher,
|
||||||
voucher_types,
|
voucher_types,
|
||||||
@ -130,6 +131,7 @@ app.include_router(maintenance.router, prefix="/api/maintenance", tags=["setting
|
|||||||
|
|
||||||
app.include_router(db_integrity.router, prefix="/api/db-integrity", tags=["management"])
|
app.include_router(db_integrity.router, prefix="/api/db-integrity", tags=["management"])
|
||||||
app.include_router(rebase.router, prefix="/api/rebase", tags=["management"])
|
app.include_router(rebase.router, prefix="/api/rebase", tags=["management"])
|
||||||
|
app.include_router(title.router, prefix="/api/title")
|
||||||
|
|
||||||
|
|
||||||
def init() -> None:
|
def init() -> None:
|
||||||
|
11
brewman/brewman/routers/title.py
Normal file
11
brewman/brewman/routers/title.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from fastapi import APIRouter
|
||||||
|
|
||||||
|
from ..core.config import settings
|
||||||
|
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("", response_model=str)
|
||||||
|
async def get_version() -> str:
|
||||||
|
return settings.TITLE
|
@ -1,3 +1,4 @@
|
|||||||
|
TITLE="{{ title }}"
|
||||||
HOST=0.0.0.0
|
HOST=0.0.0.0
|
||||||
PORT=80
|
PORT=80
|
||||||
LOG_LEVEL=WARN
|
LOG_LEVEL=WARN
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: acc
|
name: acc
|
||||||
|
title: "The Great Bear"
|
||||||
|
|
||||||
http_host: "acc.hopsngrains.com"
|
http_host: "acc.hopsngrains.com"
|
||||||
http_conf: "acc.hopsngrains.com.conf"
|
http_conf: "acc.hopsngrains.com.conf"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: exp
|
name: exp
|
||||||
|
title: Tanshu
|
||||||
|
|
||||||
http_host: "exp.tanshu.com"
|
http_host: "exp.tanshu.com"
|
||||||
http_conf: "exp.tanshu.com.conf"
|
http_conf: "exp.tanshu.com.conf"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: hinchco
|
name: hinchco
|
||||||
|
title: Mozimo
|
||||||
|
|
||||||
http_host: "acc.hinchco.in"
|
http_host: "acc.hinchco.in"
|
||||||
http_conf: "acc.hinchco.in.conf"
|
http_conf: "acc.hinchco.in.conf"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: hops
|
name: hops
|
||||||
|
title: "HnG Panchkula"
|
||||||
|
|
||||||
|
|
||||||
http_host: "hops.hopsngrains.com"
|
http_host: "hops.hopsngrains.com"
|
||||||
http_conf: "hops.hopsngrains.com.conf"
|
http_conf: "hops.hopsngrains.com.conf"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: mhl
|
name: mhl
|
||||||
|
title: "HnG Mohali"
|
||||||
|
|
||||||
http_host: "mhl.hopsngrains.com"
|
http_host: "mhl.hopsngrains.com"
|
||||||
http_conf: "mhl.hopsngrains.com.conf"
|
http_conf: "mhl.hopsngrains.com.conf"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<mat-toolbar class="fixed-to-top">
|
<mat-toolbar class="fixed-to-top">
|
||||||
<span class="mr-5"><a routerLink="/">HnG / TGB</a></span>
|
<span class="mr-5"
|
||||||
|
><a routerLink="/">{{ title }}</a></span
|
||||||
|
>
|
||||||
<mat-menu #voucherMenu="matMenu">
|
<mat-menu #voucherMenu="matMenu">
|
||||||
<a mat-menu-item routerLink="/journal">Journal</a>
|
<a mat-menu-item routerLink="/journal">Journal</a>
|
||||||
<a mat-menu-item routerLink="/purchase">Purchase</a>
|
<a mat-menu-item routerLink="/purchase">Purchase</a>
|
||||||
|
@ -1,18 +1,30 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
|
import { environment } from '../../../environments/environment';
|
||||||
import { AuthService } from '../../auth/auth.service';
|
import { AuthService } from '../../auth/auth.service';
|
||||||
|
import { TitleService } from '../title.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-nav-bar',
|
selector: 'app-nav-bar',
|
||||||
templateUrl: './nav-bar.component.html',
|
templateUrl: './nav-bar.component.html',
|
||||||
styleUrls: ['./nav-bar.component.css'],
|
styleUrls: ['./nav-bar.component.css'],
|
||||||
})
|
})
|
||||||
export class NavBarComponent {
|
export class NavBarComponent implements OnInit {
|
||||||
|
title: string;
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
public auth: AuthService,
|
public auth: AuthService,
|
||||||
) {}
|
public titleService: TitleService,
|
||||||
|
) {
|
||||||
|
this.title = environment.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.titleService.get().subscribe((value) => {
|
||||||
|
this.title = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
this.auth.logout();
|
this.auth.logout();
|
||||||
|
25
overlord/src/app/core/title.service.ts
Normal file
25
overlord/src/app/core/title.service.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
|
import { catchError } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { ErrorLoggerService } from './error-logger.service';
|
||||||
|
|
||||||
|
const url = '/api/title';
|
||||||
|
const serviceName = 'VoucherService';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class TitleService {
|
||||||
|
constructor(
|
||||||
|
private http: HttpClient,
|
||||||
|
private log: ErrorLoggerService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
get(): Observable<string> {
|
||||||
|
return this.http
|
||||||
|
.get<string>(url)
|
||||||
|
.pipe(catchError(this.log.handleError(serviceName, 'Get Title'))) as Observable<string>;
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ export const environment = {
|
|||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
||||||
version: '11.3.1',
|
version: '11.3.1',
|
||||||
|
title: 'HnG / TGB',
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user