Skip to content

Commit

Permalink
docs: sdk (#222)
Browse files Browse the repository at this point in the history
Signed-off-by: stefanicjuraj <[email protected]>
  • Loading branch information
stefanicjuraj authored Jan 7, 2025
1 parent 2c49a9b commit 4c3bc8c
Show file tree
Hide file tree
Showing 12 changed files with 1,268 additions and 18 deletions.
5 changes: 4 additions & 1 deletion src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ const algoliaEnabled =
><Fragment set:html={documentationIcon} />Documentation
</a>
</div>
<a href={import.meta.env.BASE_URL} class="dotfiles-logo">v<Version /> </a>
<a href="/docs" class="navbar-item">PRODUCT</a>
<a href="/docs/sdk" class="navbar-item">SDK</a>
<a href="/docs/tools/api" class="navbar-item">API</a>
<div class="nav__items_side_menu">
<a href={import.meta.env.BASE_URL} class="dotfiles-logo">v<Version /> </a>
{
algoliaEnabled && (
<p id="search-icon" class="search-click">
Expand Down
96 changes: 95 additions & 1 deletion src/components/Sidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,104 @@
import SidebarSublist from './SidebarSublist.astro'
import { SideNavLinks } from './menu/SideNavLinks'
const sdkSidebar = [
{
type: 'group',
entries: [
{
type: 'link',
href: '/docs/sdk',
label: 'SDK Home',
attrs: {
icon: 'home.svg',
},
},
],
},
{
type: 'group',
label: 'About',
entries: [
{
type: 'link',
href: '/docs/sdk/getting-started',
label: 'Getting Started',
attrs: {
icon: 'bookmark.svg',
},
},
{
type: 'link',
href: '/docs/sdk/configuration',
label: 'Configuration',
attrs: {
icon: 'git-commit.svg',
},
},
],
},
{
type: 'group',
label: 'Workspaces',
entries: [
{
type: 'link',
href: '/docs/sdk/workspace-management',
label: 'Management',
attrs: {
icon: 'computer.svg',
},
},
],
},
{
type: 'group',
label: 'Agent Toolbox',
entries: [
{
type: 'link',
href: '/docs/sdk/file-system-operations',
label: 'File System',
attrs: {
icon: 'folder.svg',
},
},
{
type: 'link',
href: '/docs/sdk/git-operations',
label: 'Git Operations',
attrs: {
icon: 'git-branch.svg',
},
},
{
type: 'link',
href: '/docs/sdk/language-server-protocol',
label: 'Language Server Protocol',
attrs: {
icon: 'pulse.svg',
},
},
{
type: 'link',
href: '/docs/sdk/process-code-execution',
label: 'Process & Code Execution',
attrs: {
icon: 'terminal.svg',
},
},
],
},
]
const { sidebar } = Astro.props
const currentPath = Astro.url.pathname
const sidebarToUse = currentPath.startsWith('/docs/sdk') ? sdkSidebar : sidebar
---

<SidebarSublist sublist={sidebar} />
<SidebarSublist sublist={sidebarToUse} />
<div class="mobile-nav-btn nav__items_side_menu">
<SideNavLinks client:load />
</div>
22 changes: 9 additions & 13 deletions src/components/SidebarSublist.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
import { Image } from 'astro:assets'
function getSVG(name: string) {
const filepath = `/src/assets/sidebar/${name}`
const files = import.meta.glob<string>('/src/assets/sidebar/*.svg', {
Expand All @@ -16,11 +14,11 @@ function getSVG(name: string) {
}
interface Props {
sublist: any
sublist: any[]
nested?: boolean
}
const { sublist, nested } = Astro.props
const { sublist = [], nested } = Astro.props
---

<ul class:list={{ 'top-level': !nested }}>
Expand All @@ -30,24 +28,22 @@ const { sublist, nested } = Astro.props
{entry.type === 'link' ? (
<a
href={entry.href}
aria-current={entry.isCurrent && 'page'}
class:list={[entry.attrs.class]}
aria-current={entry.isCurrent ? 'page' : undefined}
class:list={[entry.attrs?.class]}
>
{entry.attrs?.icon && (
<Fragment set:html={getSVG(entry.attrs.icon)} />
)}
<span>{entry.label}</span>
</a>
) : (
) : entry.type === 'group' ? (
<div>
<summary>
<div class="group-label">
<span class="large">{entry.label}</span>
</div>
</summary>
<div class="group-label">
<span class="large">{entry.label}</span>
</div>
<Astro.self sublist={entry.entries} nested />
</div>
)}
) : null}
</li>
))
}
Expand Down
105 changes: 105 additions & 0 deletions src/content/docs/sdk/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
title: Configuration
---

import Label from '@components/Label.astro'

<Label>
Distribution: **Open Source**
</Label>

The Daytona SDK provides flexible configuration options to customize its behavior and connection settings.

## Configuration Options

### Python Configuration

Daytona SDK provides an option to configure settings using the `DaytonaConfig` class. The `DaytonaConfig` class accepts the following parameters:

```python
from daytona_sdk import DaytonaConfig

config = DaytonaConfig(
api_key="your-api-key",
server_url="your-server-url",
target="local"
)
```

- `api_key`: Your Daytona API key
- `server_url`: URL of your Daytona server
- `target`: Daytona Target to create the Workspaces on.

### TypeScript Configuration

Daytona SDK provides an option to configure settings using the `DaytonaConfig` interface. The `DaytonaConfig` interface includes these properties:

```typescript
import { DaytonaConfig } from '@daytona/sdk';

const config: DaytonaConfig = {
apiKey: "your-api-key",
serverUrl: "your-server-url",
target: "local"
};
```

- `apiKey`: Your Daytona API key.
- `serverUrl`: URL of your Daytona server.
- `target`: Daytona Target to create the Workspaces on.
- `timeout`: Request timeout in milliseconds.
- `verifySsl`: Enable SSL verification.

## Environment Variables

Daytona SDK supports environment variables for configuration. The SDK automatically looks for these environment variables:

| Variable | Description | Default |
|----------|-------------|---------|
| **`DAYTONA_API_KEY`** | Your Daytona API key. | None |
| **`DAYTONA_SERVER_URL`** | URL of your Daytona server. | None |
| **`DAYTONA_TARGET`** | Daytona Target to create the Workspaces on. | "local" |

### Setting Environment Variables

Daytona SDK can read configuration from environment variables. You can set these environment variables using the following methods:

- [Using a **`.env`** file](#using-a-env-file)
- [Using Shell Environment](#using-shell-environment)

#### Using a **`.env`** File

Create a `.env` file in your project root directory:

```bash
DAYTONA_API_KEY=your-api-key
DAYTONA_SERVER_URL=https://your-server-url
DAYTONA_TARGET=local
```

- `DAYTONA_API_KEY`: Your Daytona API key.
- `DAYTONA_SERVER_URL`: URL of your Daytona server.
- `DAYTONA_TARGET`: Daytona Target to create the Workspaces on.

#### Using Shell Environment

Set environment variables in your shell:

```bash
# Bash/Zsh
export DAYTONA_API_KEY=your-api-key
export DAYTONA_SERVER_URL=https://your-server-url

# Windows PowerShell
$env:DAYTONA_API_KEY="your-api-key"
$env:DAYTONA_SERVER_URL="https://your-server-url"
```

## Configuration Precedence

The SDK uses the following precedence order for configuration (highest to lowest):

1. Explicitly passed configuration in code.
2. Environment variables.
3. Configuration file.
4. Default values.
Loading

0 comments on commit 4c3bc8c

Please sign in to comment.