Skip to content
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

Unable to specify store-id when importing a store from file or creating new #331

Open
PatrickMunsey opened this issue May 23, 2024 · 5 comments

Comments

@PatrickMunsey
Copy link

I'm unable to create a store either from a file or scratch while specifying the store-id.

I'd like to be able to specify the store id during creation so that the entire configuration and secret management for setting up openfga can be set prior to deployment.

I've seen that store-id can be specified for the openfga CLI fga store import command, however specifying the store id with --store-id leads to the store not being created at all.

e.g.
fga store import --file test-store.yaml --store-id 01HYHGP755KA1BQMBR568RVKKV

# test-store.yaml
name: test-store
model: |+
  model
    schema 1.1

  type user

  type group
    relations
      define member: [user]

  type folder
    relations
      define can_create_file: owner
      define owner: [user]
      define parent: [folder]
      define viewer: [user, user:*, group#member] or owner or viewer from parent

  type doc
    relations
      define can_change_owner: owner
      define can_read: viewer or owner or viewer from parent
      define can_share: owner or owner from parent
      define can_write: owner or owner from parent
      define owner: [user]
      define parent: [folder]
      define viewer: [user, user:*, group#member]

tuples: []
tests:
  - name: Tests
    check: []

fga store list

{
  "continuation_token":"",
  "stores": []
}

It would also be nice to se a --store-id parameter added to the fga store create command.

e.g. fga store create --name test-store --model test-model.fga --store-id 01HYHGP755KA1BQMBR568RVKKV

@PatrickMunsey
Copy link
Author

Just came accross a similar issue in the actual openfga engine repo. openfga/openfga#1132 (comment)

@aaguiarz
Copy link
Member

Hi @PatrickMunsey

The fact that you can specify store-id in fga store import is a bug. As you've seen, we don't use that store id, because we can't set it.

We understand the value of being able to easily know the store_id / model_id for configuration management, but we haven't been able to work on this problem yet.

@abdok96
Copy link

abdok96 commented Aug 17, 2024

This is very essential when using docker compose and setting up some init scripts.
There should be a way to determine the store id so that it can be passed as env variable to other services.

@lvieirajr
Copy link

It would definitely be very interesting to be able to create static store ids/model ids for local development and such.

@c-thiel
Copy link

c-thiel commented Oct 7, 2024

+1 for this, also for production deployments. Our application is deployed hundreds of times, each with its own openfga.
Currently the same model in a store with the same name has different model and store ids in each deployment. This is really hard to manage, as this information is needlessly dynamic. It would be great to specify this at runtime, so that a simple getStore request is sufficient to see if a specific model version exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

5 participants