Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
I
IA-Short
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WWW
IA-Short
Commits
657ee72e
Commit
657ee72e
authored
Feb 21, 2019
by
132ikl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic Flask/Jinja setup and basic YAML config
parent
c2d8d5af
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
0 deletions
+64
-0
.gitignore
.gitignore
+3
-0
config.yml
config.yml
+9
-0
liteshort.py
liteshort.py
+28
-0
securepass.sh
securepass.sh
+24
-0
No files found.
.gitignore
View file @
657ee72e
...
...
@@ -102,3 +102,6 @@ venv.bak/
# mypy
.mypy_cache/
# PyCharm
.idea
config.yml
0 → 100644
View file @
657ee72e
# Username to make admin API requests
admin_username
:
'
admin'
# Plaintext password to make admin API requests
# Safe to remove if admin_hashed_password is set
#admin_password: 'password'
# Hashed password (bcrypt) to make admin API requests - Preferred over plaintext, use securepass.sh to generate
admin_hashed_password
:
'
test'
liteshort.py
0 → 100644
View file @
657ee72e
from
flask
import
Flask
import
yaml
def
load_config
():
new_config
=
yaml
.
load
(
open
(
"config.yml"
))
if
"admin_hashed_password"
in
new_config
.
keys
():
new_config
[
"password"
]
=
new_config
[
"admin_hashed_password"
]
elif
"admin_password"
in
new_config
.
keys
():
new_config
[
"password"
]
=
new_config
[
"admin_password"
]
else
:
raise
Exception
(
"admin_password or admin_hashed_password must be set in config.yml"
)
return
new_config
config
=
load_config
()
print
(
config
[
"password"
])
app
=
Flask
(
__name__
)
@
app
.
route
(
'/'
)
def
hello_world
():
return
'Hello World!'
if
__name__
==
'__main__'
:
app
.
run
()
securepass.sh
0 → 100755
View file @
657ee72e
#!/bin/sh
## bcrypt passwd generator ##
#############################
CMD
=
$(
which htpasswd 2>/dev/null
)
OPTS
=
"-nBC 15"
read
-p
"Username: "
USERNAME
check_config
()
{
if
[
-z
$CMD
]
;
then
printf
"Exiting: htpasswd is missing.
\n
"
exit
1
fi
if
[
-z
"
$USERNAME
"
]
;
then
usage
fi
}
check_config
$USERNAME
printf
"Generating Bcrypt hash for username:
$USERNAME
\n\n
"
$CMD
$OPTS
$USERNAME
exit
$?
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment