Add docker support
- Allow setup script to get credentials from flags - Add Dockerfile and docker_entrypoint - Edit README for forked version
This commit is contained in:
parent
9ae33644e5
commit
9782f0321f
5 changed files with 78 additions and 58 deletions
|
@ -34,6 +34,9 @@ parser.add_argument('--version', action='version', version=__version__)
|
|||
parser.add_argument('--client-credentials-file', dest='clientcredfile', help='the name of the client credentials for the Mastodon app', default='feed2toot_clientcred.txt')
|
||||
parser.add_argument('--user-credentials-file', dest='usercredfile', help='the name of the user credentials for the Mastodon app', default='feed2toot_usercred.txt')
|
||||
parser.add_argument('--name', help='the name of the Mastodon app', default='feed2toot')
|
||||
parser.add_argument('--instance', help='the URL of the Mastodon instance')
|
||||
parser.add_argument('--username', help='the username of your Mastodon account')
|
||||
parser.add_argument('--password', help='the password of your Mastodon account')
|
||||
opts = parser.parse_args()
|
||||
|
||||
clientcredfile=opts.clientcredfile
|
||||
|
@ -44,7 +47,9 @@ print(headline)
|
|||
|
||||
|
||||
# get the instance
|
||||
instance = input('Mastodon instance URL (defaults to https://mastodon.social): ')
|
||||
instance = opts.instance
|
||||
if not instance:
|
||||
instance = input('Mastodon instance URL (defaults to https://mastodon.social): ')
|
||||
if not instance:
|
||||
instance = 'https://mastodon.social'
|
||||
elif not instance.startswith('http'):
|
||||
|
@ -52,19 +57,25 @@ elif not instance.startswith('http'):
|
|||
|
||||
# get the username
|
||||
userok = False
|
||||
quit_on_error = True
|
||||
while not userok:
|
||||
user = input('Mastodon login: ')
|
||||
user = opts.username
|
||||
if not user:
|
||||
user = input('Mastodon login: ')
|
||||
quit_on_error = False
|
||||
if not user:
|
||||
print('Your Mastodon username can not be empty.')
|
||||
userok = False
|
||||
elif '@' not in user or '.' not in user:
|
||||
print('Your Mastodon username should be an email.')
|
||||
userok = False
|
||||
else:
|
||||
userok = True
|
||||
if not userok and quit_on_error:
|
||||
exit()
|
||||
|
||||
# get the password
|
||||
password = getpass(prompt='Mastodon password: ')
|
||||
password = opts.password
|
||||
if not password:
|
||||
password = getpass(prompt='Mastodon password: ')
|
||||
Mastodon.create_app(
|
||||
opts.name,
|
||||
api_base_url=instance,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue