зеркало из https://github.com/mozilla/fxa.git
refactor(support-panel): rename to fxa-support-panel for consistency
This commit is contained in:
Родитель
2f91afa9bd
Коммит
4095612295
|
@ -221,7 +221,7 @@ jobs:
|
|||
environment:
|
||||
- MYSQL_DATABASE: fxa
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||
- MYSQL_ROOT_PASSWORD: ''
|
||||
- MYSQL_ROOT_PASSWORD: ""
|
||||
- image: redis
|
||||
working_directory: ~/project/packages/fxa-email-service
|
||||
steps:
|
||||
|
@ -319,8 +319,8 @@ workflows:
|
|||
requires:
|
||||
- install
|
||||
- build-module:
|
||||
name: support-panel
|
||||
module: support-panel
|
||||
name: fxa-support-panel
|
||||
module: fxa-support-panel
|
||||
requires:
|
||||
- install
|
||||
- install-content-server:
|
||||
|
|
|
@ -55,7 +55,7 @@ cd fxa-geodb; npm i; cd ..
|
|||
|
||||
cd fxa-email-event-proxy; npm ci; cd ..
|
||||
|
||||
cd support-panel ; npm ci; cd ..
|
||||
cd fxa-support-panel ; npm ci; cd ..
|
||||
|
||||
cd ..
|
||||
|
||||
|
|
|
@ -43,9 +43,7 @@
|
|||
{
|
||||
"name": "content-server PORT 3030",
|
||||
"script": "node_modules/.bin/grunt",
|
||||
"args": [
|
||||
"server"
|
||||
],
|
||||
"args": ["server"],
|
||||
"cwd": "packages/fxa-content-server",
|
||||
"env": {
|
||||
"NODE_ENV": "development"
|
||||
|
@ -182,10 +180,7 @@
|
|||
"name": "payments server PORT 3031",
|
||||
"cwd": "packages/fxa-payments-server",
|
||||
"script": "npm",
|
||||
"args": [
|
||||
"run",
|
||||
"start-dev"
|
||||
],
|
||||
"args": ["run", "start-dev"],
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m",
|
||||
"env": {
|
||||
|
@ -195,12 +190,9 @@
|
|||
},
|
||||
{
|
||||
"name": "support admin panel PORT 7100",
|
||||
"cwd": "packages/support-panel",
|
||||
"cwd": "packages/fxa-support-panel",
|
||||
"script": "npm",
|
||||
"args": [
|
||||
"run",
|
||||
"start-dev"
|
||||
],
|
||||
"args": ["run", "start-dev"],
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m",
|
||||
"env": {
|
||||
|
@ -211,10 +203,7 @@
|
|||
{
|
||||
"name": "event-broker",
|
||||
"script": "npm",
|
||||
"args": [
|
||||
"run",
|
||||
"start-dev"
|
||||
],
|
||||
"args": ["run", "start-dev"],
|
||||
"cwd": "packages/fxa-event-broker",
|
||||
"max_restarts": "1",
|
||||
"env": {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
Support Panel
|
||||
=============
|
||||
# Support Panel
|
||||
|
||||
This is a small internal tool to help Mozilla support agents view some Firefox Accounts information
|
|
@ -10,7 +10,12 @@ const mustache = require("mustache");
|
|||
const config = require("./config").getProperties();
|
||||
const Raven = require("raven");
|
||||
|
||||
const pageTemplate = fs.readFileSync(path.join(__dirname, "templates/index.html"), {encoding: "UTF-8"});
|
||||
const pageTemplate = fs.readFileSync(
|
||||
path.join(__dirname, "templates/index.html"),
|
||||
{
|
||||
encoding: "UTF-8"
|
||||
}
|
||||
);
|
||||
mustache.parse(pageTemplate);
|
||||
|
||||
function formatDate(d) {
|
||||
|
@ -24,20 +29,23 @@ const app = express();
|
|||
|
||||
app.get("/__lbheartbeat__", (req, res) => {
|
||||
res.status(200).json({});
|
||||
})
|
||||
});
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
// The fxa uid being queried:
|
||||
let uid = req.query.uid;
|
||||
if (!uid) {
|
||||
res.type("text").status(400).send("No ?uid given");
|
||||
res
|
||||
.type("text")
|
||||
.status(400)
|
||||
.send("No ?uid given");
|
||||
return;
|
||||
}
|
||||
// This is the user who is asking for the information:
|
||||
let requestTicket = req.query.requestTicket || "ticket-unknown";
|
||||
// FIXME: use appropriate header
|
||||
let authUser = req.headers["X-Unknown-Header"];
|
||||
logging.info("info-request", {uid, requestTicket, authUser});
|
||||
logging.info("info-request", { uid, requestTicket, authUser });
|
||||
let view = {
|
||||
uid,
|
||||
email: "test@example.com",
|
||||
|
@ -51,17 +59,17 @@ app.get("/", (req, res) => {
|
|||
{
|
||||
name: "laptop",
|
||||
type: "desktop",
|
||||
created: formatDate(new Date(Date.now() - 1000000000)),
|
||||
created: formatDate(new Date(Date.now() - 1000000000))
|
||||
},
|
||||
{
|
||||
name: "phone",
|
||||
type: "android",
|
||||
created: formatDate(new Date(Date.now() - 1000000000)),
|
||||
}
|
||||
created: formatDate(new Date(Date.now() - 1000000000))
|
||||
}
|
||||
],
|
||||
os: "linux",
|
||||
twoFactorAuth: false,
|
||||
subscriptionStatus: "no subscription",
|
||||
subscriptionStatus: "no subscription"
|
||||
};
|
||||
res.send(mustache.render(pageTemplate, view));
|
||||
});
|
|
@ -0,0 +1,72 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const convict = require("convict");
|
||||
|
||||
const conf = convict({
|
||||
env: {
|
||||
default: "production",
|
||||
doc: "The current node.js environment",
|
||||
env: "NODE_ENV",
|
||||
format: ["development", "production"]
|
||||
},
|
||||
listen: {
|
||||
host: {
|
||||
default: "127.0.0.1",
|
||||
doc: "The ip address the server should bind",
|
||||
env: "IP_ADDRESS",
|
||||
format: "ipaddress"
|
||||
},
|
||||
port: {
|
||||
default: 7100,
|
||||
doc: "The port the server should bind",
|
||||
env: "PORT",
|
||||
format: "port"
|
||||
},
|
||||
publicUrl: {
|
||||
default: "http://127.0.0.1:3031",
|
||||
env: "PUBLIC_URL",
|
||||
format: "url"
|
||||
}
|
||||
},
|
||||
logging: {
|
||||
app: { default: "fxa-support-panel" },
|
||||
fmt: {
|
||||
default: "heka",
|
||||
env: "LOGGING_FORMAT",
|
||||
format: ["heka", "pretty"]
|
||||
},
|
||||
level: {
|
||||
default: "info",
|
||||
env: "LOG_LEVEL"
|
||||
},
|
||||
routes: {
|
||||
enabled: {
|
||||
default: true,
|
||||
doc: "Enable route logging. Set to false to trimming CI logs.",
|
||||
env: "ENABLE_ROUTE_LOGGING"
|
||||
},
|
||||
format: {
|
||||
default: "default_fxa",
|
||||
format: ["default_fxa", "dev_fxa", "default", "dev", "short", "tiny"]
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// handle configuration files. you can specify a CSV list of configuration
|
||||
// files to process, which will be overlayed in order, in the CONFIG_FILES
|
||||
// environment variable.
|
||||
|
||||
let envConfig = path.join(__dirname, `${conf.get("env")}.json`);
|
||||
envConfig = `${envConfig},${process.env.CONFIG_FILES || ""}`;
|
||||
const files = envConfig.split(",").filter(fs.existsSync);
|
||||
conf.loadFile(files);
|
||||
conf.validate({ allowed: "strict" });
|
||||
|
||||
module.exports = conf;
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const mozlog = require('mozlog');
|
||||
const config = require('./config').getProperties();
|
||||
const mozlog = require("mozlog");
|
||||
const config = require("./config").getProperties();
|
||||
|
||||
module.exports = mozlog(config.logging)("supportpanel");
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
const { app } = require("./app");
|
||||
const logging = require("./logging");
|
||||
|
@ -10,11 +10,11 @@ const config = require("./config").getProperties();
|
|||
|
||||
const { port, host } = config.listen;
|
||||
logging.info("server.starting", { host, port });
|
||||
app.listen(port, host, (error) => {
|
||||
app.listen(port, host, error => {
|
||||
if (error) {
|
||||
logging.error('server.start.error', { error });
|
||||
logging.error("server.start.error", { error });
|
||||
return;
|
||||
}
|
||||
|
||||
logging.info('server.started', { host, port });
|
||||
logging.info("server.started", { host, port });
|
||||
});
|
|
@ -1,83 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const convict = require('convict');
|
||||
|
||||
const conf = convict({
|
||||
env: {
|
||||
default: 'production',
|
||||
doc: 'The current node.js environment',
|
||||
env: 'NODE_ENV',
|
||||
format: [ 'development', 'production' ],
|
||||
},
|
||||
listen: {
|
||||
host: {
|
||||
default: '127.0.0.1',
|
||||
doc: 'The ip address the server should bind',
|
||||
env: 'IP_ADDRESS',
|
||||
format: 'ipaddress',
|
||||
},
|
||||
port: {
|
||||
default: 7100,
|
||||
doc: 'The port the server should bind',
|
||||
env: 'PORT',
|
||||
format: 'port',
|
||||
},
|
||||
publicUrl: {
|
||||
default: 'http://127.0.0.1:3031',
|
||||
env: 'PUBLIC_URL',
|
||||
format: 'url',
|
||||
},
|
||||
},
|
||||
logging: {
|
||||
app: { default: 'support-panel' },
|
||||
fmt: {
|
||||
default: 'heka',
|
||||
env: 'LOGGING_FORMAT',
|
||||
format: [
|
||||
'heka',
|
||||
'pretty'
|
||||
],
|
||||
},
|
||||
level: {
|
||||
default: 'info',
|
||||
env: 'LOG_LEVEL'
|
||||
},
|
||||
routes: {
|
||||
enabled: {
|
||||
default: true,
|
||||
doc: 'Enable route logging. Set to false to trimming CI logs.',
|
||||
env: 'ENABLE_ROUTE_LOGGING'
|
||||
},
|
||||
format: {
|
||||
default: 'default_fxa',
|
||||
format: [
|
||||
'default_fxa',
|
||||
'dev_fxa',
|
||||
'default',
|
||||
'dev',
|
||||
'short',
|
||||
'tiny'
|
||||
]
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// handle configuration files. you can specify a CSV list of configuration
|
||||
// files to process, which will be overlayed in order, in the CONFIG_FILES
|
||||
// environment variable.
|
||||
|
||||
let envConfig = path.join(__dirname, `${conf.get('env') }.json`);
|
||||
envConfig = `${envConfig },${ process.env.CONFIG_FILES || ''}`;
|
||||
const files = envConfig.split(',').filter(fs.existsSync);
|
||||
conf.loadFile(files);
|
||||
conf.validate({ allowed: 'strict' });
|
||||
|
||||
|
||||
module.exports = conf;
|
19
servers.json
19
servers.json
|
@ -51,7 +51,7 @@
|
|||
"cwd": "packages/fxa-auth-server/fxa-oauth-server",
|
||||
"env": {
|
||||
"NODE_ENV": "dev",
|
||||
"HOST" : "0.0.0.0"
|
||||
"HOST": "0.0.0.0"
|
||||
},
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m"
|
||||
|
@ -177,10 +177,7 @@
|
|||
"name": "payments server PORT 3031",
|
||||
"cwd": "packages/fxa-payments-server",
|
||||
"script": "npm",
|
||||
"args": [
|
||||
"run",
|
||||
"build-start-dev"
|
||||
],
|
||||
"args": ["run", "build-start-dev"],
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m",
|
||||
"env": {
|
||||
|
@ -190,12 +187,9 @@
|
|||
},
|
||||
{
|
||||
"name": "support admin panel PORT 7100",
|
||||
"cwd": "packages/support-panel",
|
||||
"cwd": "packages/fxa-support-panel",
|
||||
"script": "npm",
|
||||
"args": [
|
||||
"run",
|
||||
"start-dev"
|
||||
],
|
||||
"args": ["run", "start-dev"],
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m",
|
||||
"env": {
|
||||
|
@ -206,10 +200,7 @@
|
|||
{
|
||||
"name": "event-broker",
|
||||
"script": "npm",
|
||||
"args": [
|
||||
"run",
|
||||
"start-dev"
|
||||
],
|
||||
"args": ["run", "start-dev"],
|
||||
"cwd": "packages/fxa-event-broker",
|
||||
"max_restarts": "1",
|
||||
"env": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче