-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added root tokens and endpoint for adding api keys #742
Conversation
yk
commented
Jan 15, 2023
- added root tokens
- added an admin api router for creating api clients
- changed the dummy api key mechanism to only support the fixed key 1234
Note: I did not provide a server default for the root token entry in the api client table, thus, we'll have to wipe DBs upon merging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, now we need to clarify how the create_api key endpoint is called, e.g. manually via /docs ui, by a pythin-script (cmdline tool) or a special mode of the frontend when an api-key is missing in the config.
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add op.execute("DELETE FROM api_client;")
?
backend/oasst_backend/api/deps.py
Outdated
logger.info(f"ANY_API_KEY missing, inserting api_key: {DUMMY_API_KEY}") | ||
api_client = create_api_client( | ||
db=db, | ||
added_by_root_token="1234", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the value is hardcoded here, we could use something else, e.g. 4711 or 0000 to distinguish it from api-keys created with a settings.ROOT_TOKENS value..
|