Skip to content

Commit 3df1f13

Browse files
erpaswonder-sk
authored andcommitted
Add hint for setting MERGIN_AUTH variable in Windows
1 parent d441cf2 commit 3df1f13

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,12 @@ is not permanent - it will expire after several hours.
142142
$ mergin --username john login
143143
Password: topsecret
144144
Login successful!
145-
To set the MERGIN_AUTH variable run:
145+
To set the MERGIN_AUTH variable run in Linux:
146146
export MERGIN_AUTH="Bearer ......."
147+
In Windows:
148+
SET MERGIN_AUTH=Bearer .......
147149
```
150+
When setting the variable in Windows you do not quote the value.
148151

149152
When the MERGIN_AUTH env variable is set (or passed with `--auth-token` command line argument),
150153
it is possible to run other commands without specifying username/password.

mergin/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import click
1212
import json
1313
import os
14+
import platform
1415
import sys
1516
import time
1617
import traceback
@@ -177,7 +178,11 @@ def login(ctx):
177178
if mc is not None:
178179
click.secho("Login successful!", fg="green")
179180
token = mc._auth_session["token"]
180-
click.secho(f'To set the MERGIN_AUTH variable run:\nexport MERGIN_AUTH="{token}"')
181+
if platform.system() == "Windows":
182+
hint = f'To set the MERGIN_AUTH variable run:\nset MERGIN_AUTH={token}'
183+
else:
184+
hint = f'To set the MERGIN_AUTH variable run:\nexport MERGIN_AUTH="{token}"'
185+
click.secho(hint)
181186

182187

183188
@cli.command()

0 commit comments

Comments
 (0)