Skip to content

Commit f24d709

Browse files
authored
Merge pull request #4 from Filiosoft/develop
Confidential Milestone Improvements
2 parents 743ecf2 + 1af6102 commit f24d709

20 files changed

+798
-75
lines changed

CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## How to contribute to GitLab Roadmap
2+
3+
#### **Did you find a bug?**
4+
5+
- **Do not open up a GitHub issue if the bug is a security vulnerability
6+
in GitLab Roadmap**, and instead to refer to our [security policy](SECURITY.md).
7+
8+
- **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/Filiosoft/gitlab-roadmap/issues).
9+
10+
- If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/Filiosoft/gitlab-roadmap/issues/new). Be sure to include a **title and clear description**, and as much relevant information as possible.
11+
12+
#### **Did you write a patch that fixes a bug?**
13+
14+
- Open a new GitHub pull request with the patch.
15+
16+
- Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
17+
18+
#### **Do you intend to add a new feature or change an existing one?**
19+
20+
- Suggest your change and start writing code.
21+
22+
- Do not open an issue on GitHub until you have collected positive feedback about the change. GitHub issues are primarily intended for bug reports and fixes.
23+
24+
#### **Do you have questions about the source code?**
25+
26+
- Ask any question about how to use GitLab Roadmap by emailing [Noah]([email protected]).
27+
28+
Thanks!
29+
30+
Noah Prail
31+
32+
_This CONTRIBUTING.md file was adapted from the [Rails CONTRIBUTING.md](https://github.com/rails/rails/blob/master/CONTRIBUTING.md)_

README.md

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,90 @@
1010
</p>
1111
<p align="center"><b>📢 Create a product roadmap website with GitLab Issue Boards as a backend!</b></p>
1212

13-
## Quick Start
13+
## Setup
14+
15+
### Quick Start (Heroku)
1416

1517
Click the button below to deploy on Heroku!
1618

1719
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/Filiosoft/gitlab-roadmap)
1820

19-
## Install on AWS Lambda
21+
### Slower Start (AWS Lambda)
22+
23+
If you want to deploy to AWS Lambda, follow the steps below:
24+
25+
Clone the repository
26+
27+
```
28+
$ git clone https://github.com/Filiosoft/gitlab-roadmap
29+
```
30+
31+
Install the dependencies
32+
33+
```
34+
$ npm install
35+
```
2036

2137
Copy `config.example.yml` to `config.yml` and edit it to your liking
2238

2339
```
2440
$ cp config.example.yml config.yml
2541
```
2642

43+
Setup the domain (see [here](https://github.com/amplify-education/serverless-domain-manager) for more instructions)
44+
45+
```
46+
$ npx sls create_domain
47+
```
48+
49+
And finally, deploy
50+
51+
```
52+
$ npx sls deploy
53+
```
54+
55+
### Development Setup
56+
57+
Want to contribute? Awesome! First checkout the [contribution guidelines](#contributing) then follow these steps to get setup.
58+
59+
Clone the repository
60+
61+
```
62+
$ git clone https://github.com/Filiosoft/gitlab-roadmap
63+
```
64+
2765
Install the dependencies
2866

2967
```
3068
$ npm install
3169
```
3270

33-
And then run the following:
71+
Copy `example.env` to `.env` and edit it to your liking
3472

3573
```
36-
$ npx sls deploy
74+
$ cp example.env .env
3775
```
3876

77+
Start the dev server
78+
79+
```
80+
$ npm run dev
81+
```
82+
83+
## Contributing
84+
85+
Please read [CONTRIBUTING.md](https://github.com/Filiosoft/gitlab-roadmap/blob/develop/CONTRIBUTING.md) for details on our [code of conduct](https://github.com/Filiosoft/gitlab-roadmap/blob/develop/CODE_OF_CONDUCT.md), and the process for submitting pull requests to us.
86+
87+
## Versioning
88+
89+
We use [semantic-release](https://github.com/semantic-release/semantic-release) for versioning. Every commit to `master` will generate a release. For the versions available, see the [releases on the repositories](https://github.com/Filiosoft/gitlab-roadmap/releases).
90+
91+
## Credits
92+
93+
- **Noah Prail** - _Project Lead_ - [@nprail](https://github.com/nprail)
94+
95+
See also the list of [contributors](https://github.com/Filiosoft/gitlab-roadmap/contributors) who participated in this project.
96+
3997
## License
4098

41-
[MIT](LICENSE)
99+
[MIT](https://github.com/Filiosoft/gitlab-roadmap/blob/develop/LICENSE)

SECURITY.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# GitLab Roadmap Security
2+
3+
## Found a Vulnerability?
4+
5+
If you have found a security vulnerability, do _**NOT**_ create a regular issue!!! Instead, encrypt the issue with `gpg` or `openssl`.
6+
7+
### GPG
8+
9+
To report an issue with GPG, follow these steps:
10+
11+
1. Write the issue in a markdown file (e.g. `issue.md`)
12+
2. Import the public key: `gpg --keyserver keyserver.ubuntu.com --recv 51AB060B`
13+
3. Encrypt the `issue.md` file: `gpg --recipient 51AB060B --armor --encrypt issue.md`
14+
4. Copy the contents of the `issue.md.asc` file and create a [new issue](https://github.com/Filiosoft/gitlab-roadmap/issues/new) with that.
15+
16+
### OpenSSL
17+
18+
To report an issue with OpenSSL, follow these steps:
19+
20+
1. Write the issue in a markdown file (e.g. `issue.md`)
21+
2. Install `cipherhub`: `[sudo] npm install -g cipherhub`
22+
3. Encrypt the `issue.md` file: `cipherhub nprail < issue.md`
23+
4. Copy output and create a [new issue](https://github.com/Filiosoft/gitlab-roadmap/issues/new) with that.

app.js

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,14 @@
11
const express = require('express')
22

3-
const { internalConfig, config } = require('./config/config')()
4-
const axios = require('./config/axios')(internalConfig)
5-
63
const app = express()
74

85
// setup express app
96
require('./config/express')(app)
107

11-
app.get('/', async (req, res, next) => {
12-
try {
13-
const resp = await Promise.all([
14-
axios.get(`/boards/${internalConfig.board_id}`),
15-
axios.get('/?statistics=true')
16-
])
17-
const boardResp = resp[0]
18-
const projectResp = resp[1]
19-
const lists = boardResp.data.lists
20-
const project = projectResp.data
21-
22-
if (boardResp.status !== 200) {
23-
const err = new Error(
24-
`Non-200 response code from GitLab: ${boardResp.status}`
25-
)
26-
err.status = boardResp.status
27-
return next(err)
28-
}
29-
30-
const maps = lists.map(async list => {
31-
const resp = await axios.get(`/issues?labels=${list.label.name}`)
32-
list.issues = resp.data
33-
list.noIssues = list.issues.length < 1
34-
})
35-
36-
await Promise.all(maps)
8+
// setup passport
9+
require('./config/passport')(app)
3710

38-
const sendData = {
39-
lists,
40-
project,
41-
config
42-
}
43-
return res.render('home', sendData)
44-
} catch (err) {
45-
return next(err)
46-
}
47-
})
11+
app.use('/', require('./routes')())
4812

4913
// setup error handlers
5014
require('./lib/errorHandler')(app)

app.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,28 @@
2525
"description": "ID of GitLab issue board",
2626
"required": true
2727
},
28+
"GL_RM_INT_CONFIG_GL_APP": {
29+
"description": "Enable login with GitLab?",
30+
"value":"false",
31+
"required": false
32+
},
33+
"GL_RM_INT_CONFIG_GL_CLIENT_ID": {
34+
"description": "GitLab application client ID",
35+
"required": false
36+
},
37+
"GL_RM_INT_CONFIG_GL_CLIENT_SECRET": {
38+
"description": "GitLab application client secret",
39+
"required": false
40+
},
41+
"GL_RM_INT_CONFIG_BASE_URL": {
42+
"description": "Base url of the roadmap",
43+
"required": false
44+
},
45+
"GL_RM_INT_CONFIG_COOKIE_SECRET": {
46+
"description": "Random secret for cookies",
47+
"generator":"secret",
48+
"required": false
49+
},
2850
"GL_RM_CONFIG_THEME": {
2951
"description": "Bootstrap CSS theme",
3052
"value": "https://bootswatch.com/4/materia/bootstrap.min.css",

bin/www.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
const app = require('../app')
88
const http = require('http')
9+
const debug = require('debug')('glrm:http')
910

1011
/**
1112
* Get port from environment and store in Express.
@@ -54,10 +55,10 @@ function onError (error) {
5455
// handle specific listen errors with friendly messages
5556
switch (error.code) {
5657
case 'EACCES':
57-
console.error(bind + ' requires elevated privileges')
58+
debug(`${bind} requires elevated privileges`)
5859
process.exit(1)
5960
case 'EADDRINUSE':
60-
console.error(bind + ' is already in use')
61+
debug(`${bind} is already in use`)
6162
process.exit(1)
6263
default:
6364
throw error
@@ -70,8 +71,8 @@ function onError (error) {
7071

7172
function onListening () {
7273
const addr = server.address()
73-
const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port
74-
console.log('Listening on ' + bind)
74+
const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`
75+
debug(`Listening on ${bind}`)
7576
}
7677

7778
/**

config.example.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ internal-config:
33
url: https://gitlab.com # gitlab instance address
44
project-id: filiosoft/roadmap # can be ID or path
55
board-id: 49 # issue board ID
6+
gl-app: true # enable login with GitLab?
7+
gl-client-id: f135d8df73f083f632d877ffa4d5252e953255de5bd78458cbe994dbb92cc9a9 # gitlab application client id
8+
gl-client-secret: 51ca773af0789f1c6afe1a8a118364cace26fa06a511227acfa9f5de0c83da13 # gitlab application client secret
9+
base-url: https://roadmap.filiosoft.com # base url of roadmap
10+
cookie-secret: change-me # random secret
611
config:
712
theme: https://bootswatch.com/4/materia/bootstrap.min.css # boostrap theme
813
domain: roadmap.filiosoft.com # domain to deploy to

config/config.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ const getConfig = () => {
44
const internalConfig = {}
55
const config = {}
66

7-
// convert undefined string to actual undefined
8-
const convertUndefined = input => {
7+
// convert undefined, true, and false string to type
8+
const convert = input => {
99
if (input === 'undefined') {
1010
return undefined
11+
} else if (input === 'false') {
12+
return false
13+
} else if (input === 'true') {
14+
return true
1115
}
1216
return input
1317
}
1418

1519
const loadConfig = (prefix, object) => {
1620
for (const key in process.env) {
1721
if (key.startsWith(prefix)) {
18-
const newValue = convertUndefined(process.env[key])
22+
const newValue = convert(process.env[key])
1923
const newKey = key.replace(prefix, '').toLowerCase()
2024

2125
object[newKey] = newValue

config/express.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
11
const cors = require('cors')
22
const exphbs = require('express-handlebars')
33
const moment = require('moment')
4+
const morgan = require('morgan')
5+
const debug = require('debug')('glrm:express')
46

5-
module.exports = app => {
7+
const { internalConfig, config } = require('../config')()
8+
const axios = require('../config/axios')(internalConfig)
9+
10+
module.exports = async app => {
11+
// set config globals
12+
app.locals.config = config
13+
app.locals.appEnabled = internalConfig.gl_app
14+
try {
15+
const projectResp = await axios.get('/')
16+
app.locals.project = projectResp.data
17+
} catch (err) {
18+
debug(err)
19+
}
20+
21+
// setup middleware
22+
app.use(morgan('dev'))
623
app.use(cors())
24+
25+
// setup view engine
726
app.engine(
827
'.hbs',
928
exphbs({
1029
extname: '.hbs',
1130
defaultLayout: 'main',
1231
helpers: {
1332
moment: input => {
14-
return moment(input).format('MMMM Do YYYY, h:mm:ss a')
33+
return moment(input).format('MMMM Do YYYY')
1534
}
1635
}
1736
})

0 commit comments

Comments
 (0)