Skip to content

Commit 18f61b7

Browse files
committed
docs
1 parent 19fd1eb commit 18f61b7

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

README.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,49 @@
1212

1313
### 1. Set up Infisical
1414

15-
This assumes you have a working Infisical account and have created a project with secrets.
15+
- Set up an Infisical account if you haven't already. Create a project with secrets.
16+
- Install the Infisical CLI tool on your device by following the instructions at [Infisical CLI Installation](https://docs.infisical.com/cli/installation).
1617

17-
1. Install the Infisical CLI tool on your device by following the instructions at [Infisical CLI Installation](https://docs.infisical.com/cli/installation).
18-
2. Run `infisical login` to authenticate.
19-
3. Run `infisical init` to select the project and generate the `.infisical.json` file. We recommend committing this file to your repository.
18+
### 2. Authenticate and configure your project
2019

21-
### 2. Install this package
20+
You can authenticate and configure your project in one of two ways:
21+
22+
- **Login with identity**:
23+
24+
Run [`infisical login`](https://infisical.com/docs/cli/commands/login) to authenticate with a user identity or a machine identity.
25+
26+
Then run [`infisical init`](https://infisical.com/docs/cli/commands/init) to select the project and generate the `.infisical.json` file. We recommend committing this file to your repository.
27+
28+
29+
- **Use a service token**:
30+
31+
Create a Service Token scoped for your designed environment.
32+
33+
Copy your specific Project ID from your Infisical settings page.
34+
35+
Set the following environment variables in your base `.env` file:
36+
37+
```dotenv
38+
INFISICAL_PROJECT_ID=your-project-id
39+
INFISICAL_TOKEN=your-service-token
40+
```
41+
42+
### 3. Install this package
2243
2344
You know the drill:
2445
2546
```bash
2647
composer require stechstudio/laravel-infisical
2748
```
2849

29-
### 3. Specify your environment
50+
### 4. Specify your environment
3051

3152
Infisical needs to know which environment to pull secrets from. You can do this one of three ways:
3253

33-
- **Environment Variable**: Set the `INFISICAL_ENV` environment variable in a base `.env` file to the desired environment slug.
54+
- **Environment Variable**: Set the `INFISICAL_ENVIRONMENT` environment variable in a base `.env` file to the desired environment slug.
3455

3556
```dotenv
36-
INFISICAL_ENV=prod
57+
INFISICAL_ENVIRONMENT=prod
3758
```
3859
- **CLI Argument**: Pass the `--env` option when running the Artisan command.
3960

@@ -54,7 +75,7 @@ Infisical needs to know which environment to pull secrets from. You can do this
5475
> [!IMPORTANT]
5576
> You must provide the _slug_ of an existing environment. See your project Settings > Secrets Management page to view all your environments and slugs.
5677

57-
### 4. Run the command (manually or automatically)
78+
### 5. Run the command (manually or automatically)
5879

5980
You can run the command manually to merge secrets into your `.env` file, or add it to your deployment scripts.
6081

@@ -70,7 +91,7 @@ You can also add this to the `scripts` section of your `composer.json` file. Thi
7091
],
7192
```
7293

73-
### 5. Profit!
94+
### 6. Profit!
7495

7596
You should see "Environment [prod] variables merged successfully". If you look at your `.env` file you should see that all the secrets from Infisical have been added to it.
7697

config/infisical.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
return [
33
'environment' => env('INFISICAL_ENVIRONMENT', 'prod'),
44
'token' => env('INFISICAL_TOKEN'),
5+
'project_id' => env('INFISICAL_PROJECT_ID'),
56
];

src/Commands/Merge.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function handle()
2222
'export',
2323
"--env=$environment",
2424
config('infisical.token') ? "--token=".config('infisical.token') : null,
25+
config('infisical.project_id') ? "--projectId=".config('infisical.project_id') : null,
2526
]));
2627

2728
if (!$result->successful()) {

src/Commands/Verify.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function handle()
2525
'--plain',
2626
"--env=$environment",
2727
config('infisical.token') ? "--token=".config('infisical.token') : null,
28+
config('infisical.project_id') ? "--projectId=".config('infisical.project_id') : null,
2829
]));
2930

3031
if ($result->successful() && !empty($result->output())) {

0 commit comments

Comments
 (0)