Skip to content

Commit

Permalink
기초 셋팅 완료됨
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveDev42 committed Oct 12, 2016
1 parent bdb5b4d commit f6558f5
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -87,3 +134,18 @@ ENV/

# Rope project settings
.ropeproject
### VirtualEnv template
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json

.idea
34 changes: 34 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
from sys import platform as _platform

from flask import Flask, abort, request
from flask import request
app = Flask(__name__)


# 104.192.143.192/28
# 104.192.143.208/28
trusted_remote_addrs = list(map(
lambda last: '104.192.143.' + str(last),
list(range(192, 192 + 16)) + list(range(208, 208 + 16))
)) + ['127.0.0.1']


@app.before_request
def limit_remote_addr():
if request.remote_addr not in trusted_remote_addrs:
abort(403)


@app.route('/webhook', methods=['GET', 'POST'])
def tracking():
if request.method == 'POST':
data = request.get_json()
commit_author = data['actor']['username']
commit_hash = data['push']['changes'][0]['new']['target']['hash'][:7]
commit_url = data['push']['changes'][0]['new']['target']['links']['html']['href']
print('Webhook received! %s committed %s' % (commit_author, commit_hash))
return 'OK'

if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)

0 comments on commit f6558f5

Please sign in to comment.