Skip to content

Commit

Permalink
added gh token
Browse files Browse the repository at this point in the history
  • Loading branch information
clemenko committed Apr 17, 2024
1 parent 7a12152 commit c2b0920
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
21 changes: 12 additions & 9 deletions dzver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,35 @@
version = "0.1"
app = Flask(__name__)

gh_token = os.getenv('GITHUB_TOKEN')
headers = {'authorization': 'Bearer'gh_token}

@app.route('/json', methods=['GET'])
def json_all_the_things():
rke_data = json.loads(requests.get("https://update.rke2.io/v1-release/channels").text)
rke_out = json.dumps(rke_data["data"][0]["latest"]).replace('"', '')

k3s_data = json.loads(requests.get("https://update.k3s.io/v1-release/channels").text)
k3s_out = json.dumps(k3s_data["data"][0]["latest"]).replace('"', '')

cert_data = json.loads(requests.get("https://api.github.com/repos/cert-manager/cert-manager/releases/latest").text)
cert_data = json.loads(requests.get("https://api.github.com/repos/cert-manager/cert-manager/releases/latest", headers=headers).text)
cert_out = json.dumps(cert_data["tag_name"]).replace('"', '')

rancher_data = json.loads(requests.get("https://api.github.com/repos/rancher/rancher/releases/latest").text)
rancher_data = json.loads(requests.get("https://api.github.com/repos/rancher/rancher/releases/latest", headers=headers).text)
rancher_out = json.dumps(rancher_data["tag_name"]).replace('"', '')

longhorn_data = json.loads(requests.get("https://api.github.com/repos/longhorn/longhorn/releases/latest").text)
longhorn_data = json.loads(requests.get("https://api.github.com/repos/longhorn/longhorn/releases/latest", headers=headers).text)
longhorn_out = json.dumps(longhorn_data["tag_name"]).replace('"', '')

neuvector_data = json.loads(requests.get("https://api.github.com/repos/neuvector/neuvector/releases/latest").text)
neuvector_data = json.loads(requests.get("https://api.github.com/repos/neuvector/neuvector/releases/latest", headers=headers).text)
neuvector_out = json.dumps(neuvector_data["tag_name"]).replace('"', '')

harvester_data = json.loads(requests.get("https://api.github.com/repos/harvester/harvester/releases/latest").text)
harvester_data = json.loads(requests.get("https://api.github.com/repos/harvester/harvester/releases/latest", headers=headers).text)
harvester_out = json.dumps(harvester_data["tag_name"]).replace('"', '')

hauler_data = json.loads(requests.get("https://api.github.com/repos/rancherfederal/hauler/releases/latest").text)
hauler_data = json.loads(requests.get("https://api.github.com/repos/rancherfederal/hauler/releases/latest", headers=headers).text)
hauler_out = json.dumps(hauler_data["tag_name"]).replace('"', '')

k3s_data = json.loads(requests.get("https://update.k3s.io/v1-release/channels").text)
k3s_out = json.dumps(k3s_data["data"][0]["latest"]).replace('"', '')

return jsonify({'k3s': k3s_out, 'rke2': rke_out, 'cert-manager': cert_out, 'rancher': rancher_out, 'longhorn': longhorn_out, 'neuvector': neuvector_out, 'harvester': harvester_out, 'hauler': hauler_out}), 200

@app.route('/', methods=['GET'])
Expand Down
1 change: 0 additions & 1 deletion flask_simple/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
redis = Redis(host='redis', port=6379)
server_name = os.getenv('HOSTNAME')


@app.route('/healthz')
def health_check():
return jsonify({'redis': 'up', 'storage': 'up'}), 200
Expand Down

0 comments on commit c2b0920

Please sign in to comment.