Skip to content

Commit

Permalink
Fix if nginx not found and setup ci
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Sep 4, 2024
1 parent c073f56 commit 4454aed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/domcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ jobs:
webhook_auth: ${{ secrets.WEBHOOK_AUTH_AMS }}
data: >-
{"commands":["git pull","npm i","npm test","sudo systemctl restart bridge"]}
- name: Invoke TYO deployment hook
- name: Invoke NUE deployment hook
uses: distributhor/workflow-webhook@v3
env:
webhook_url: https://my.domcloud.co/api/githubdeploy
webhook_secret: ${{ secrets.WEBHOOK_SECRET_TYO }}
webhook_auth: ${{ secrets.WEBHOOK_AUTH_TYO }}
webhook_secret: ${{ secrets.WEBHOOK_SECRET_NUE }}
webhook_auth: ${{ secrets.WEBHOOK_AUTH_NUE }}
data: >-
{"commands":["git pull","npm i","npm test","sudo systemctl restart bridge"]}
- name: Invoke BLR deployment hook
- name: Invoke OSK deployment hook
uses: distributhor/workflow-webhook@v3
env:
webhook_url: https://my.domcloud.co/api/githubdeploy
webhook_secret: ${{ secrets.WEBHOOK_SECRET_BLR }}
webhook_auth: ${{ secrets.WEBHOOK_AUTH_BLR }}
webhook_secret: ${{ secrets.WEBHOOK_SECRET_OSK }}
webhook_auth: ${{ secrets.WEBHOOK_AUTH_OSK }}
data: >-
{"commands":["git pull","npm i","npm test","sudo systemctl restart bridge"]}
- name: Invoke SAO deployment hook
Expand Down
27 changes: 13 additions & 14 deletions src/executor/nginx.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,19 +318,18 @@ class NginxExecutor {
/**
* @param {string} domain
*/
async get(domain) {
return await executeLock('nginx', () => {
get(domain) {
return executeLock('nginx', () => {
return new Promise((resolve, reject) => {
spawnSudoUtil('NGINX_GET', [domain]).then(() => {
NginxConfFile.create(tmpFile, (err, conf) => {
if (err)
return reject(err);
try {
let node = conf.nginx;
return resolve(node.server[0]);
} catch (error) {
return reject(error);
const node = conf.nginx.server?.[0];
if (!node) {
return reject(new Error(`Cannot find domain ${domain}`));
}
return resolve(node);
});
}).catch(reject);
});
Expand All @@ -340,15 +339,15 @@ class NginxExecutor {
* @param {string} domain
* @param {any} config
*/
async set(domain, config) {
return await executeLock('nginx', async () => {
set(domain, config) {
return executeLock('nginx', async () => {
await spawnSudoUtil('NGINX_GET', [domain]);
return await new Promise((resolve, reject) => {
var src = cat(tmpFile).toString();
NginxConfFile.createFromSource(src, (err, conf) => {
if (err)
return reject(err);
const node = conf.nginx.server[0];
const node = conf.nginx.server?.[0];
if (!node) {
return reject(new Error(`Cannot find domain ${domain}`));
}
Expand All @@ -369,8 +368,8 @@ class NginxExecutor {
* @param {string} domain
* @param {any} info
*/
async setDirect(domain, info) {
return await executeLock('nginx', async () => {
setDirect(domain, info) {
return executeLock('nginx', async () => {
await spawnSudoUtil('NGINX_GET', [domain]);
return await new Promise((resolve, reject) => {
var src = cat(tmpFile).toString();
Expand All @@ -397,8 +396,8 @@ class NginxExecutor {
* @param {string} ssl
* @param {string} http
*/
async setSsl(domain, ssl, http) {
return await executeLock('nginx', async () => {
setSsl(domain, ssl, http) {
return executeLock('nginx', async () => {
await spawnSudoUtil('NGINX_GET', [domain]);
return await new Promise((resolve, reject) => {
var src = cat(tmpFile).toString();
Expand Down

0 comments on commit 4454aed

Please sign in to comment.