parent
c56f0706a4
commit
b0123afee8
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/loc-chain-backend.iml" filepath="$PROJECT_DIR$/.idea/loc-chain-backend.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,15 @@
|
|||||||
import { env } from '@extollo/lib'
|
import { env } from '@extollo/lib'
|
||||||
|
import * as fs from "fs"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: env('APP_NAME', 'Extollo'),
|
name: env('APP_NAME', 'Extollo'),
|
||||||
|
|
||||||
|
firebase: {
|
||||||
|
credentials: JSON.parse(
|
||||||
|
fs.readFileSync(env('FIREBASE_CREDENTIALS'))
|
||||||
|
.toString('utf-8')
|
||||||
|
),
|
||||||
|
|
||||||
|
defaultRTDB: env('FIREBASE_DEFAULT_RTDB', 'https://loc-chain-default-rtdb.firebaseio.com'),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,16 @@
|
|||||||
import {Controller, view, Session} from '@extollo/lib';
|
import {Controller, view, Session} from '@extollo/lib';
|
||||||
import {Inject, Injectable} from "@extollo/di";
|
import {Inject, Injectable} from "@extollo/di";
|
||||||
import {Locale} from "@extollo/i18n"
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Home extends Controller {
|
export class Home extends Controller {
|
||||||
@Inject()
|
@Inject()
|
||||||
protected readonly session!: Session;
|
protected readonly session!: Session;
|
||||||
|
|
||||||
@Inject()
|
|
||||||
protected readonly locale!: Locale;
|
|
||||||
|
|
||||||
public welcome() {
|
public welcome() {
|
||||||
this.session.set('app_visits', this.session.get('app_visits', 0) + 1)
|
this.session.set('app_visits', this.session.get('app_visits', 0) + 1)
|
||||||
|
|
||||||
return view('welcome', {
|
return view('welcome', {
|
||||||
app_visits: this.session.get('app_visits'),
|
app_visits: this.session.get('app_visits'),
|
||||||
locale: this.locale.helper(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
import {Singleton, Inject} from "@extollo/di"
|
||||||
|
import {Unit, Logging, Config} from "@extollo/lib"
|
||||||
|
import * as firebase from "firebase-admin"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FirebaseUnit Unit
|
||||||
|
* ---------------------------------------
|
||||||
|
* Fetch credentials from config and setup the firebase-admin connection.
|
||||||
|
*/
|
||||||
|
@Singleton()
|
||||||
|
export class FirebaseUnit extends Unit {
|
||||||
|
protected _firebase = firebase;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
protected readonly logging!: Logging
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
protected readonly config!: Config
|
||||||
|
|
||||||
|
get() {
|
||||||
|
return this._firebase
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Called on app start. */
|
||||||
|
public async up() {
|
||||||
|
this.logging.info('Initializing Firebase application credentials...')
|
||||||
|
this._firebase.initializeApp({
|
||||||
|
credential: firebase.credential.cert(this.config.get('app.firebase.credentials')),
|
||||||
|
databaseURL: this.config.get('app.firebase.defaultRTDB'),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Called on app shutdown. */
|
||||||
|
public async down() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue