Skip to content

Commit

Permalink
chore: use FGA_ prefix for example env vars to match the cli
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamzeh authored and booniepepper committed Dec 6, 2023
1 parent 0858aa3 commit 730bd07
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 86 deletions.
34 changes: 17 additions & 17 deletions config/clients/dotnet/template/README_initializing.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ namespace Example {
public static async Task Main() {
try {
var configuration = new ClientConfiguration() {
ApiScheme = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_API_SCHEME"), // optional, defaults to "https"
ApiHost = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
AuthorizationModelId = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_AUTHORIZATION_MODEL_ID"), // Optional, can be overridden per request
ApiScheme = Environment.GetEnvironmentVariable("FGA_API_SCHEME"), // optional, defaults to "https"
ApiHost = Environment.GetEnvironmentVariable("FGA_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId = Environment.GetEnvironmentVariable("FGA_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
AuthorizationModelId = Environment.GetEnvironmentVariable("FGA_AUTHORIZATION_MODEL_ID"), // Optional, can be overridden per request
};
var fgaClient = new {{appShortName}}Client(configuration);
var response = await fgaClient.ReadAuthorizationModels();
Expand All @@ -41,14 +41,14 @@ namespace Example {
public static async Task Main() {
try {
var configuration = new ClientConfiguration() {
ApiScheme = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_API_SCHEME"), // optional, defaults to "https"
ApiHost = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
AuthorizationModelId = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_AUTHORIZATION_MODEL_ID"), // Optional, can be overridden per request
ApiScheme = Environment.GetEnvironmentVariable("FGA_API_SCHEME"), // optional, defaults to "https"
ApiHost = Environment.GetEnvironmentVariable("FGA_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId = Environment.GetEnvironmentVariable("FGA_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
AuthorizationModelId = Environment.GetEnvironmentVariable("FGA_AUTHORIZATION_MODEL_ID"), // Optional, can be overridden per request
Credentials = new Credentials() {
Method = CredentialsMethod.ApiToken,
Config = new CredentialsConfig() {
ApiToken = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_API_TOKEN"), // will be passed as the "Authorization: Bearer ${ApiToken}" request header
ApiToken = Environment.GetEnvironmentVariable("FGA_API_TOKEN"), // will be passed as the "Authorization: Bearer ${ApiToken}" request header
}
}
};
Expand All @@ -74,17 +74,17 @@ namespace Example {
public static async Task Main() {
try {
var configuration = new ClientConfiguration() {
ApiScheme = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_API_SCHEME"), // optional, defaults to "https"
ApiHost = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
AuthorizationModelId = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_AUTHORIZATION_MODEL_ID"), // Optional, can be overridden per request
ApiScheme = Environment.GetEnvironmentVariable("FGA_API_SCHEME"), // optional, defaults to "https"
ApiHost = Environment.GetEnvironmentVariable("FGA_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId = Environment.GetEnvironmentVariable("FGA_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
AuthorizationModelId = Environment.GetEnvironmentVariable("FGA_AUTHORIZATION_MODEL_ID"), // Optional, can be overridden per request
Credentials = new Credentials() {
Method = CredentialsMethod.ClientCredentials,
Config = new CredentialsConfig() {
ApiTokenIssuer = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_API_TOKEN_ISSUER"),
ApiAudience = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_API_AUDIENCE"),
ClientId = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_CLIENT_ID"),
ClientSecret = Environment.GetEnvironmentVariable("{{appUpperCaseName}}_CLIENT_SECRET"),
ApiTokenIssuer = Environment.GetEnvironmentVariable("FGA_API_TOKEN_ISSUER"),
ApiAudience = Environment.GetEnvironmentVariable("FGA_API_AUDIENCE"),
ClientId = Environment.GetEnvironmentVariable("FGA_CLIENT_ID"),
ClientSecret = Environment.GetEnvironmentVariable("FGA_CLIENT_SECRET"),
}
}
};
Expand Down
28 changes: 14 additions & 14 deletions config/clients/go/template/README_initializing.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

func main() {
fgaClient, err := NewSdkClient(&ClientConfiguration{
ApiScheme: os.Getenv("{{appUpperCaseName}}_API_SCHEME"), // optional, defaults to "https"
ApiHost: os.Getenv("{{appUpperCaseName}}_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId: os.Getenv("{{appUpperCaseName}}_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
ApiScheme: os.Getenv("FGA_API_SCHEME"), // optional, defaults to "https"
ApiHost: os.Getenv("FGA_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId: os.Getenv("FGA_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
})

if err != nil {
Expand All @@ -34,13 +34,13 @@ import (

func main() {
fgaClient, err := NewSdkClient(&ClientConfiguration{
ApiScheme: os.Getenv("{{appUpperCaseName}}_API_SCHEME"), // optional, defaults to "https"
ApiHost: os.Getenv("{{appUpperCaseName}}_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId: os.Getenv("{{appUpperCaseName}}_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
ApiScheme: os.Getenv("FGA_API_SCHEME"), // optional, defaults to "https"
ApiHost: os.Getenv("FGA_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId: os.Getenv("FGA_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
Credentials: &credentials.Credentials{
Method: credentials.CredentialsMethodApiToken,
Config: &credentials.Config{
ApiToken: os.Getenv("{{appUpperCaseName}}_API_TOKEN"), // will be passed as the "Authorization: Bearer ${ApiToken}" request header
ApiToken: os.Getenv("FGA_API_TOKEN"), // will be passed as the "Authorization: Bearer ${ApiToken}" request header
},
},
})
Expand All @@ -63,17 +63,17 @@ import (

func main() {
fgaClient, err := NewSdkClient(&ClientConfiguration{
ApiScheme: os.Getenv("{{appUpperCaseName}}_API_SCHEME"), // optional, defaults to "https"
ApiHost: os.Getenv("{{appUpperCaseName}}_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId: os.Getenv("{{appUpperCaseName}}_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
ApiScheme: os.Getenv("FGA_API_SCHEME"), // optional, defaults to "https"
ApiHost: os.Getenv("FGA_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId: os.Getenv("FGA_STORE_ID"), // not needed when calling `CreateStore` or `ListStores`
AuthorizationModelId: {{packageName}}.PtrString("{{appUpperCaseName}}_AUTHORIZATION_MODEL_ID"),
Credentials: &credentials.Credentials{
Method: credentials.CredentialsMethodClientCredentials,
Config: &credentials.Config{
ClientCredentialsClientId: os.Getenv("{{appUpperCaseName}}_CLIENT_ID"),
ClientCredentialsClientSecret: os.Getenv("{{appUpperCaseName}}_CLIENT_SECRET"),
ClientCredentialsApiAudience: os.Getenv("{{appUpperCaseName}}_API_AUDIENCE"),
ClientCredentialsApiTokenIssuer: os.Getenv("{{appUpperCaseName}}_API_TOKEN_ISSUER"),
ClientCredentialsClientId: os.Getenv("FGA_CLIENT_ID"),
ClientCredentialsClientSecret: os.Getenv("FGA_CLIENT_SECRET"),
ClientCredentialsApiAudience: os.Getenv("FGA_API_AUDIENCE"),
ClientCredentialsApiTokenIssuer: os.Getenv("FGA_API_TOKEN_ISSUER"),
},
},
})
Expand Down
28 changes: 14 additions & 14 deletions config/clients/java/template/README_initializing.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import java.net.http.HttpClient;
public class Example {
public static void main(String[] args) throws Exception {
var config = new ClientConfiguration()
.apiUrl(System.getenv("{{appUpperCaseName}}_API_URL")) // If not specified, will default to "https://localhost:8080"
.storeId(System.getenv("{{appUpperCaseName}}_STORE_ID")) // Not required when calling createStore() or listStores()
.authorizationModelId(System.getenv("{{appUpperCaseName}}_AUTHORIZATION_MODEL_ID")); // Optional, can be overridden per request
.apiUrl(System.getenv("FGA_API_URL")) // If not specified, will default to "https://localhost:8080"
.storeId(System.getenv("FGA_STORE_ID")) // Not required when calling createStore() or listStores()
.authorizationModelId(System.getenv("FGA_AUTHORIZATION_MODEL_ID")); // Optional, can be overridden per request
var fgaClient = new OpenFgaClient(config);
var response = fgaClient.readAuthorizationModels().get();
Expand All @@ -32,11 +32,11 @@ import java.net.http.HttpClient;
public class Example {
public static void main(String[] args) throws Exception {
var config = new ClientConfiguration()
.apiUrl(System.getenv("{{appUpperCaseName}}_API_URL")) // If not specified, will default to "https://localhost:8080"
.storeId(System.getenv("{{appUpperCaseName}}_STORE_ID")) // Not required when calling createStore() or listStores()
.authorizationModelId(System.getenv("{{appUpperCaseName}}_AUTHORIZATION_MODEL_ID")) // Optional, can be overridden per request
.apiUrl(System.getenv("FGA_API_URL")) // If not specified, will default to "https://localhost:8080"
.storeId(System.getenv("FGA_STORE_ID")) // Not required when calling createStore() or listStores()
.authorizationModelId(System.getenv("FGA_AUTHORIZATION_MODEL_ID")) // Optional, can be overridden per request
.credentials(new Credentials(
new ApiToken(System.getenv("{{appUpperCaseName}}_API_TOKEN")) // will be passed as the "Authorization: Bearer ${ApiToken}" request header
new ApiToken(System.getenv("FGA_API_TOKEN")) // will be passed as the "Authorization: Bearer ${ApiToken}" request header
));
var fgaClient = new OpenFgaClient(config);
Expand All @@ -58,15 +58,15 @@ import java.net.http.HttpClient;
public class Example {
public static void main(String[] args) throws Exception {
var config = new ClientConfiguration()
.apiUrl(System.getenv("{{appUpperCaseName}}_API_URL")) // If not specified, will default to "https://localhost:8080"
.storeId(System.getenv("{{appUpperCaseName}}_STORE_ID")) // Not required when calling createStore() or listStores()
.authorizationModelId(System.getenv("{{appUpperCaseName}}_AUTHORIZATION_MODEL_ID")) // Optional, can be overridden per request
.apiUrl(System.getenv("FGA_API_URL")) // If not specified, will default to "https://localhost:8080"
.storeId(System.getenv("FGA_STORE_ID")) // Not required when calling createStore() or listStores()
.authorizationModelId(System.getenv("FGA_AUTHORIZATION_MODEL_ID")) // Optional, can be overridden per request
.credentials(new Credentials(
new ClientCredentials()
.apiTokenIssuer(System.getenv("{{appUpperCaseName}}_API_TOKEN_ISSUER"))
.apiAudience(System.getenv("{{appUpperCaseName}}_API_AUDIENCE"))
.clientId(System.getenv("{{appUpperCaseName}}_CLIENT_ID"))
.clientSecret(System.getenv("{{appUpperCaseName}}_CLIENT_SECRET"))
.apiTokenIssuer(System.getenv("FGA_API_TOKEN_ISSUER"))
.apiAudience(System.getenv("FGA_API_AUDIENCE"))
.clientId(System.getenv("FGA_CLIENT_ID"))
.clientSecret(System.getenv("FGA_CLIENT_SECRET"))
));
var fgaClient = new OpenFgaClient(config);
Expand Down
34 changes: 17 additions & 17 deletions config/clients/js/template/README_initializing.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ The documentation below refers to the `{{appShortName}}Client`, to read the docu
const { {{appShortName}}Client } = require('{{packageName}}'); // OR import { {{appShortName}}Client } from '{{packageName}}';

const fgaClient = new {{appShortName}}Client({
apiScheme: {{appUpperCaseName}}_API_SCHEME, // optional, defaults to "https"
apiHost: {{appUpperCaseName}}_API_HOST, // required, define without the scheme (e.g. api.{{sampleApiDomain}} instead of https://api.{{sampleApiDomain}})
storeId: {{appUpperCaseName}}_STORE_ID, // not needed when calling `CreateStore` or `ListStores`
authorizationModelId: {{appUpperCaseName}}_AUTHORIZATION_MODEL_ID, // Optional, can be overridden per request
apiScheme: process.env.FGA_API_SCHEME, // optional, defaults to "https"
apiHost: process.env.FGA_API_HOST, // required, define without the scheme (e.g. api.{{sampleApiDomain}} instead of https://api.{{sampleApiDomain}})
storeId: process.env.FGA_STORE_ID, // not needed when calling `CreateStore` or `ListStores`
authorizationModelId: process.env.FGA_AUTHORIZATION_MODEL_ID, // Optional, can be overridden per request
});
```

Expand All @@ -21,14 +21,14 @@ const fgaClient = new {{appShortName}}Client({
const { {{appShortName}}Client } = require('{{packageName}}'); // OR import { {{appShortName}}Client } from '{{packageName}}';

const fgaClient = new {{appShortName}}Client({
apiScheme: {{appUpperCaseName}}_API_SCHEME, // optional, defaults to "https"
apiHost: {{appUpperCaseName}}_API_HOST, // required, define without the scheme (e.g. api.{{sampleApiDomain}} instead of https://api.{{sampleApiDomain}})
storeId: {{appUpperCaseName}}_STORE_ID, // not needed when calling `CreateStore` or `ListStores`
authorizationModelId: {{appUpperCaseName}}_AUTHORIZATION_MODEL_ID, // Optional, can be overridden per request
apiScheme: process.env.FGA_API_SCHEME, // optional, defaults to "https"
apiHost: process.env.FGA_API_HOST, // required, define without the scheme (e.g. api.{{sampleApiDomain}} instead of https://api.{{sampleApiDomain}})
storeId: process.env.FGA_STORE_ID, // not needed when calling `CreateStore` or `ListStores`
authorizationModelId: process.env.FGA_AUTHORIZATION_MODEL_ID, // Optional, can be overridden per request
credentials: {
method: CredentialsMethod.ApiToken,
config: {
token: {{appUpperCaseName}}_API_TOKEN, // will be passed as the "Authorization: Bearer ${ApiToken}" request header
token: process.env.FGA_API_TOKEN, // will be passed as the "Authorization: Bearer ${ApiToken}" request header
}
}
});
Expand All @@ -40,17 +40,17 @@ const fgaClient = new {{appShortName}}Client({
const { {{appShortName}}Client } = require('{{packageName}}'); // OR import { {{appShortName}}Client } from '{{packageName}}';

const fgaClient = new {{appShortName}}Client({
apiScheme: {{appUpperCaseName}}_API_SCHEME, // optional, defaults to "https"
apiHost: {{appUpperCaseName}}_API_HOST, // required, define without the scheme (e.g. api.{{sampleApiDomain}} instead of https://api.{{sampleApiDomain}})
storeId: {{appUpperCaseName}}_STORE_ID, // not needed when calling `CreateStore` or `ListStores`
authorizationModelId: {{appUpperCaseName}}_AUTHORIZATION_MODEL_ID, // Optional, can be overridden per request
apiScheme: process.env.FGA_API_SCHEME, // optional, defaults to "https"
apiHost: process.env.FGA_API_HOST, // required, define without the scheme (e.g. api.{{sampleApiDomain}} instead of https://api.{{sampleApiDomain}})
storeId: process.env.FGA_STORE_ID, // not needed when calling `CreateStore` or `ListStores`
authorizationModelId: process.env.FGA_AUTHORIZATION_MODEL_ID, // Optional, can be overridden per request
credentials: {
method: CredentialsMethod.ClientCredentials,
config: {
apiTokenIssuer: {{appUpperCaseName}}_API_TOKEN_ISSUER,
apiAudience: {{appUpperCaseName}}_API_AUDIENCE,
clientId: {{appUpperCaseName}}_CLIENT_ID,
clientSecret: {{appUpperCaseName}}_CLIENT_SECRET,
apiTokenIssuer: process.env.FGA_API_TOKEN_ISSUER,
apiAudience: process.env.FGA_API_AUDIENCE,
clientId: process.env.FGA_CLIENT_ID,
clientSecret: process.env.FGA_CLIENT_SECRET,
}
}
});
Expand Down
Loading

0 comments on commit 730bd07

Please sign in to comment.