Skip to content

Commit

Permalink
fix: delete app management with module and use trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamensuli committed Jan 27, 2024
1 parent 6097e60 commit f6b28b2
Show file tree
Hide file tree
Showing 50 changed files with 14,211 additions and 2,947 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
dist/
node_modules/
tmp/
config/certificates
nodefony/config/certificates

# Ignore les fichiers générés par TypeScript
*.tsbuildinfo
Expand Down
33 changes: 0 additions & 33 deletions app/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions app/index.ts

This file was deleted.

28 changes: 0 additions & 28 deletions app/package.json

This file was deleted.

1 change: 0 additions & 1 deletion app/src/nodefony/config/config.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/types.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions bin/generateCertificates.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
# inspired by https://jamielinux.com/docs/openssl-certificate-authority/index.html

ROOT_DIR="./config/certificates"
CONF_DIR="./config/openssl"
ROOT_DIR="./nodefony/config/certificates"
CONF_DIR="./nodefony/config/openssl"
mkdir -p $ROOT_DIR
mkdir -p $ROOT_DIR/{client,server,ca}

Expand Down
32 changes: 32 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Kernel, Module } from "nodefony";
import config from "./nodefony/config/config";
import http from "@nodefony/http";
import security from "@nodefony/security";
import { fileURLToPath } from "url";

class App extends Module {
constructor(kernel: Kernel) {
super("app", kernel, fileURLToPath(import.meta.url), config);
kernel?.use(http);
kernel?.use(security);
}

// async onStart(): Promise<this> {
// this.log(`MODULE ${this.name} START`, "DEBUG");
// return this;
// }
// async onRegister(): Promise<this> {
// this.log(`MODULE ${this.name} REGISTER`, "DEBUG");
// return this;
// }
// async onBoot(): Promise<this> {
// this.log(`MODULE ${this.name} BOOT`, "DEBUG");
// return this;
// }
// async onReady(): Promise<this> {
// this.log(`MODULE ${this.name} READY`, "DEBUG");
// return this;
// }
}

export default App;
28 changes: 17 additions & 11 deletions config/config.js → nodefony/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const certificats = {
options: {
rejectUnauthorized: true,
},
key: "",
cert: "",
ca: "",
};
let CDN = null;
let statics = true;
Expand All @@ -36,23 +39,26 @@ let documentation = true;
let unitTest = true;
let domainCheck = false;

switch (kernel.appEnvironment) {
switch (kernel?.environment) {
case "production":
case "development":
default:
certificats.key = path.resolve(
"nodefony",
"config",
"certificates",
"server",
"privkey.pem"
);
certificats.cert = path.resolve(
"nodefony",
"config",
"certificates",
"server",
"fullchain.pem"
);
certificats.ca = path.resolve(
"nodefony",
"config",
"certificates",
"ca",
Expand All @@ -67,7 +73,7 @@ switch (kernel.appEnvironment) {
}

export default {
domain: "0.0.0.0", // "0.0.0.0" "selectAuto"
domain: "localhost", // "0.0.0.0" "selectAuto"
domainAlias: ["^127.0.0.1$", "^localhost$"],
domainCheck,
servers: {
Expand All @@ -92,15 +98,15 @@ export default {
/**
* SERVERS
*/
servers: {
statics,
protocol: "2.0", // 2.0 || 1.1
http: true,
https: true,
ws: true,
wss: true,
certificats,
},
// servers: {
// statics,
// protocol: "2.0", // 2.0 || 1.1
// http: true,
// https: true,
// ws: true,
// wss: true,
// certificats,
// },

/**
* DEV SERVER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[ default ]
ca = nodefony-ca # CA name
dir = ./config/certificates # Top dir
dir = ./nodefony/config/certificates # Top dir

# The next part of the configuration file is used by the openssl req command.
# It defines the CA's key pair, its DN, and the desired extensions for the CA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[ default ]
ca = nodefony-ca # CA name
dir = ./config/certificates # Top dir
dir = ./nodefony/config/certificates # Top dir

# The next part of the configuration file is used by the openssl req command.
# It defines the CA's key pair, its DN, and the desired extensions for the CA
Expand Down
Loading

0 comments on commit f6b28b2

Please sign in to comment.